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_headers
django_downloadview.apache.response.XSendfileResponse#__init__
django_downloadview.nginx.response.XAccelRedirectResponse#__init__
django_downloadview.lighttpd.response.XSendfileResponse#__init__