We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 49a4cc0 commit 7fa6defCopy full SHA for 7fa6def
plain/plain/assets/views.py
@@ -1,4 +1,5 @@
1
import functools
2
+import mimetypes
3
import os
4
from email.utils import formatdate, parsedate
5
from io import BytesIO
@@ -53,9 +54,12 @@ def get(self):
53
54
if not_modified_response := self.get_conditional_response(absolute_path):
55
return not_modified_response
56
57
+ content_type, _ = mimetypes.guess_type(absolute_path)
58
+
59
response = FileResponse(
60
open(absolute_path, "rb"),
- filename=os.path.basename(absolute_path), # Used for Content-Type
61
+ filename=os.path.basename(absolute_path),
62
+ content_type=content_type,
63
)
64
response.headers = self.update_headers(response.headers, absolute_path)
65
return response
0 commit comments