Opened 6 years ago
Last modified 6 years ago
#30196 closed Cleanup/optimization
Make FileResponse always set Content-Disposition header. — at Version 1
Reported by: | Piotr Kunicki | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | dev |
Severity: | Normal | Keywords: | FileResponse file response Content-Disposition header attachment inline |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
FileResponse currently sets the Content-Disposition header only if as_attachment is true.
Setting it explicitly to, e.g. 'inline; filename="example.png"' in the other case would allow the browser to set a default name for that inline file in case a user attempts to download it with the 'Save image as...' option.
That filename value is also visible in the title of the tab when image is being viewed directly in Firefox (at least v56).
Created a pull request: https://github.com/django/django/pull/11011