New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileResponse: send response either as attachment or inline #11
Conversation
@@ -33,6 +33,9 @@ class FileResponse extends Nette\Object implements Nette\Application\IResponse | |||
/** @var bool */ | |||
public $resuming = TRUE; | |||
|
|||
/** @var bool */ | |||
private $contentDispositionAttachment = TRUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What an ugly name, $isAttachment
? Or maybe better $forceDownload
?
I would add it as 4th constructor parameter as well, defaulting to TRUE and remove setter. |
*/ | ||
public function setContentDispositionAttachment($attachment = TRUE) | ||
{ | ||
return $this->contentDispositionAttachment = $attachment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setters in Nette usually return $this so they provide fluent behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Thanks!
FileResponse: send response either as attachment or inline FileResponse: send response either as attachment or inline FileResponse: send response as attachment or inline
Guys thanks a lot for your feedback! I followed the contribution guide, changed the code and forced-pushed changes here. The only problem I see is the missing line at the end of the file with tests. I can see it in my local version. I will check the settings of git, maybe it is cutting them? Or do you have any ideas? |
FileResponse: send response either as attachment or inline
This pull requests allows files in response being sent directly into browser instead of forcing them to be downloaded - this is especially helpful when there is a need to show e.g. pdf files directly in the browser window. See related issue nette/nette#1410.
As proposed in the contribution guide http://nette.org/en/contributing, I am adding following information:
I am really a newbie. I will appreciate if you provide me with some explaining comments in case you find this pull request as not acceptable. Thanks a lot!