django-sendfile
django-sendfile copied to clipboard
Incorrect content-encoding on gzip files.
If you try to use sendfile with .gz or .tgz files, the response is given the Content-Encoding of "gzip" which causes the browser (or other client) to automatically decompress it on download.
.gz files should have no content-encoding and a content-type of 'application/x-gzip' and .tgz files should have no content-encoding and a content-type of 'application/x-compressed ', I think.
I'm using:
from mimetypes import guess_type
to figure out the content-type of the file.
I think you can use that module to insert the content type you want:
https://docs.python.org/2/library/mimetypes.html#mimetypes.add_type