This causes text/csv to be guess as a mimetype for test.csv.gz. Combined with the sanitization of mimetypes, the client will be sent a text/plain content type. This causes upstream servers (like nginx) configured with to gzip plain text to compress the already compressed file again.
The mimetype is guessed like this in
models.py
Essentially only the first part is used. This however causes troubles for e.g. gzip and bzip2 compressed files:
This causes
text/csv
to be guess as a mimetype fortest.csv.gz
. Combined with the sanitization of mimetypes, the client will be sent atext/plain
content type. This causes upstream servers (like nginx) configured with to gzip plain text to compress the already compressed file again.