-
-
Notifications
You must be signed in to change notification settings - Fork 54
Description
Currently, the Content-Disposition header is only set for attachments. It would be helpful to set the Content-Disposition with a filename value for non-attachments, even though it shouldn't include attachment in the header value. This would be useful if a user decides to save a file after viewing it. It is also useful if the file in question is not supported for inline viewing in the user's browser because the browser would then have a file name to use for saving.
I believe the simplest way of doing this is as follows:
Add an attachment argument to the django_downloadview.response.content_disposition function. In content_disposition check the value of attachment and conditionally add attachment to the header value. Update calls to content_disposition to include the attachment argument in:
django_downloadview.response.DownloadResponse#default_headersdjango_downloadview.apache.response.XSendfileResponse#__init__django_downloadview.nginx.response.XAccelRedirectResponse#__init__django_downloadview.lighttpd.response.XSendfileResponse#__init__