django-sendfile icon indicating copy to clipboard operation
django-sendfile copied to clipboard

Incorrect content-encoding on gzip files.

Open pbaylas opened this issue 11 years ago • 1 comments

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.

pbaylas avatar Feb 24 '14 12:02 pbaylas

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

johnsensible avatar Mar 18 '15 11:03 johnsensible