fix error in mail parsing: not all 'inline' elements ara attachments
All checks were successful
/ test (push) Successful in 2m43s

This commit is contained in:
j3d1 2025-01-09 17:18:59 +01:00
parent 598f758332
commit 3635a55e39
2 changed files with 78 additions and 2 deletions

View file

@ -129,8 +129,11 @@ def parse_email_body(raw, log=None):
ctype = part.get_content_type()
cdispo = str(part.get('Content-Disposition'))
if ctype == 'multipart/mixed':
log.debug("Ignoring Multipart %s %s", ctype, cdispo)
# skip any text/plain (txt) attachments
if ctype == 'text/plain' and 'attachment' not in cdispo:
elif ctype == 'text/plain' and 'attachment' not in cdispo:
segment = part.get_payload()
if not segment:
continue
@ -209,7 +212,8 @@ def receive_email(envelope, log=None):
email = Email.objects.create(
sender=sender, recipient=recipient, body=body, subject=subject, reference=header_message_id,
in_reply_to=header_in_reply_to, raw_file=ContentFile(envelope.content, name=random_filename), event=target_event,
in_reply_to=header_in_reply_to, raw_file=ContentFile(envelope.content, name=random_filename),
event=target_event,
issue_thread=active_issue_thread)
for attachment in attachments:
email.attachments.add(attachment)