Skip to content

Commit 7fa6def

Browse files
committed
Manually specify content type on assets so application/gzip isn't used
1 parent 49a4cc0 commit 7fa6def

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plain/plain/assets/views.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import functools
2+
import mimetypes
23
import os
34
from email.utils import formatdate, parsedate
45
from io import BytesIO
@@ -53,9 +54,12 @@ def get(self):
5354
if not_modified_response := self.get_conditional_response(absolute_path):
5455
return not_modified_response
5556

57+
content_type, _ = mimetypes.guess_type(absolute_path)
58+
5659
response = FileResponse(
5760
open(absolute_path, "rb"),
58-
filename=os.path.basename(absolute_path), # Used for Content-Type
61+
filename=os.path.basename(absolute_path),
62+
content_type=content_type,
5963
)
6064
response.headers = self.update_headers(response.headers, absolute_path)
6165
return response

0 commit comments

Comments
 (0)