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
Support Content-Disposition of inline in send_file() #1432
Conversation
When called with a "filename" arg, send_file() sets the Content-Disposition header type to "attachment". This triggers a "Save" dialogue in some browsers when opening a link in a new tab or window. + Add an optional "content_disposition" argument to send_file() which can be set to "inline" to have the browser display the file inline. + Add a note to the manual about this new behaviour. + Add tests for "attachment" and "inline" behaviours.
The AppVeyor CI failure doesn't seem related to the contents of the PR. It looks like Strawberry perl can't install Dist::Zilla, so the build fails. |
This looks like a good improvement to me. @d5ve we try and support perl 5.8 if its at all possible. |
This would only behave differently if the caller passed in '' or 0 as the `content_disposition` arg, so the functionality should be the same.
I changed from |
@d5ve - I really like this improvement. Thanks for the change to help us support 5.8 as well. This gets a 👍 from me. |
Nice change 👍 |
Merged, thank you! |
[ BUG FIXES ] * GH #1304: Fix the order by which config files are loaded, independently of their filename extension (Alberto Simões, Russell @veryrusty Jenkins) * GH #1400: Fix infinite recursion with exceptions that use circular references. (Andre Walker) * GH #1430: Fix `dancer2 gen` from source directory when Dancer2 not installed. (Tina @perlpunk Müller - Tina) * GH #1434: Add `validate_id` method to verify a session id before requesting the session engine fetch it from its data store. (Russell @veryrusty Jenkins) * GH #1435, #1438: Allow XS crush_cookie methods to return an arrayref of values. (Russell @veryrusty Jenkins) * GH #1090, #1406: Replace HTTP::Body with HTTP::Entity::Parser in Dancer2::Core::Request. (Russell @veryrusty Jenkins) * GH #1443: Update copyright year (Joseph Frazer) * GH #1445: Use latest HTTP::Headers::Fast (Russell @veryrusty Jenkins) [ ENHANCEMENTS ] * GH #1432: Support Content-Disposition of inline in send_file() (Dave Webb) * PR #1433: Verbose testing in AppVeyor (Graham Knop) * PR #1354: TemplateToolkit template engine will log (at debug level) if a template is not found. (Kiel R Stirling, Russell @veryrusty Jenkins) [ DOCUMENTATION ] * GH #1317: Document serializer configuration (sdeseille) * PR #1426: Move performance improvement information from Migration guide to Deployment (Pedro Melo)
[ BUG FIXES ] * GH #1090, #1406: Replace HTTP::Body with HTTP::Entity::Parser in Dancer2::Core::Request. (Russell @veryrusty Jenkins) * GH #1292: Fix multiple attribute definitions within Plugins (Nigel Gregoire) * GH #1304: Fix the order by which config files are loaded, independently of their filename extension (Alberto Simões, Russell @veryrusty Jenkins) * GH #1400: Fix infinite recursion with exceptions that use circular references. (Andre Walker) * GH #1430: Fix `dancer2 gen` from source directory when Dancer2 not installed. (Tina @perlpunk Müller - Tina) * GH #1434: Add `validate_id` method to verify a session id before requesting the session engine fetch it from its data store. (Russell @veryrusty Jenkins) * GH #1435, #1438: Allow XS crush_cookie methods to return an arrayref of values. (Russell @veryrusty Jenkins) * GH #1443: Update copyright year (Joseph Frazer) * GH #1445: Use latest HTTP::Headers::Fast (Russell @veryrusty Jenkins) * PR #1447: Fix missing build requires (Mohammad S Anwar) [ ENHANCEMENTS ] * PR #1354: TemplateToolkit template engine will log (at debug level) if a template is not found. (Kiel R Stirling, Russell @veryrusty Jenkins) * GH #1432: Support Content-Disposition of inline in send_file() (Dave Webb) * PR #1433: Verbose testing in AppVeyor (Graham Knop) [ DOCUMENTATION ] * GH #1314: Documentation tweaks (David Precious) * GH #1317: Document serializer configuration (sdeseille) * GH #1386: Add Hello World example (Gabor Szabo) * PR #1408: List project development resources (Steve Dondley) * PR #1426: Move performance improvement information from Migration guide to Deployment (Pedro Melo)
When called with a "filename" arg, send_file() sets the
Content-Disposition header type to "attachment". This triggers a "Save"
dialogue in some browsers when opening a link in a new tab or window.
Add an optional "content_disposition" argument to send_file() which can be
set to "inline" to have the browser display the file inline.
Add a note to the manual about this new behaviour.
Add tests for "attachment" and "inline" behaviours.