Compare commits

..

2 Commits

2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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()))
)