Zeige E-Mail-Anlagen in der Leseansicht, damit der Inhalt nachvollziehbar bleibt.
Deploy Development / deploy (push) Successful in 29s
Deploy Development / deploy (push) Successful in 29s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f0c8981e22
commit
2664021e7f
5 files changed
+124
-18
No files matched your search
@@ -186,15 +186,18 @@ def download_mail_attachment(
|
||||
if index < 0 or index >= len(parsed.attachments):
|
||||
raise not_found()
|
||||
item = parsed.attachments[index]
|
||||
return _mail_bytes(item.data, item.media_type or "application/octet-stream", item.filename)
|
||||
return _mail_bytes(item.data, item.media_type or "application/octet-stream", item.filename, inline=True)
|
||||
|
||||
|
||||
def _mail_bytes(data: bytes, media_type: str, filename: str) -> Response:
|
||||
def _mail_bytes(data: bytes, media_type: str, filename: str, inline: bool = False) -> Response:
|
||||
disposition = content_disposition(filename)
|
||||
if inline:
|
||||
disposition = disposition.replace("attachment;", "inline;", 1)
|
||||
return Response(
|
||||
content=data,
|
||||
media_type=media_type,
|
||||
headers={
|
||||
"Content-Disposition": content_disposition(filename),
|
||||
"Content-Disposition": disposition,
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"Cache-Control": "private, no-store",
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user