Compare commits
2 Commits
ac0a6264d0
...
1524a7ef85
Author | SHA1 | Date |
---|---|---|
|
1524a7ef85 | |
|
4e94aef65a |
|
@ -190,11 +190,13 @@ def media(request, path):
|
||||||
if content_type in ("application/json", "application/xml")
|
if content_type in ("application/json", "application/xml")
|
||||||
or content_type.startswith("audio/")
|
or content_type.startswith("audio/")
|
||||||
or content_type.startswith("image/")
|
or content_type.startswith("image/")
|
||||||
or (content_type.startswith("text/") and content_type != "text/html")
|
or content_type.startswith("text/")
|
||||||
or content_type.startswith("video/")
|
or content_type.startswith("video/")
|
||||||
else "attachment"
|
else "attachment"
|
||||||
)
|
)
|
||||||
response["Content-Type"] = content_type
|
response["Content-Type"] = (
|
||||||
|
"text/plain" if content_type == "text/html" else content_type
|
||||||
|
)
|
||||||
response["X-Accel-Redirect"] = f"/protected/{path}"
|
response["X-Accel-Redirect"] = f"/protected/{path}"
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
attachments = []
|
attachments = []
|
||||||
for part in msg.walk():
|
for part in msg.walk():
|
||||||
if part.is_attachment():
|
if part.get_content_disposition() != None:
|
||||||
attachments.append(
|
attachments.append(
|
||||||
(part.get_filename(), ContentFile(part.get_content()))
|
(part.get_filename(), ContentFile(part.get_content()))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue