Compare commits
2 Commits
ac0a6264d0
...
1524a7ef85
Author | SHA1 | Date |
---|---|---|
Luca | 1524a7ef85 | |
Luca | 4e94aef65a |
|
@ -190,11 +190,13 @@ def media(request, path):
|
|||
if content_type in ("application/json", "application/xml")
|
||||
or content_type.startswith("audio/")
|
||||
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/")
|
||||
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}"
|
||||
|
||||
return response
|
||||
|
|
|
@ -74,7 +74,7 @@ class Command(BaseCommand):
|
|||
|
||||
attachments = []
|
||||
for part in msg.walk():
|
||||
if part.is_attachment():
|
||||
if part.get_content_disposition() != None:
|
||||
attachments.append(
|
||||
(part.get_filename(), ContentFile(part.get_content()))
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue