johnsensible/django-sendfile

Simple backend will decompress file

Closed this issue · 1 comments

When using simple backend to serve a gzip file (for eg: test.gz), the file is decompressed on-the-fly and the content downloaded is uncompressed. I am not sure if I make mistake somewhere.

I found out that to send a gzip file in its original form, I need to set the encoding parameter when calling the sendfile function. For eg: sendfile(request, file_path, attachment=True, mimetype='application/octet-stream', encoding='identity'). Probably this could be documented somewhere.