From 9f99eb5ee66f8283dea9f02758deefb435c0f51c Mon Sep 17 00:00:00 2001 From: Brendan Wood Date: Mon, 8 Mar 2021 13:57:07 -0400 Subject: [PATCH] fix: prepend file attachments with 'part-%i_' to prevent name collisions when an email has attachments with the same filename --- helpdesk/email.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helpdesk/email.py b/helpdesk/email.py index ea0316f1..98507dea 100644 --- a/helpdesk/email.py +++ b/helpdesk/email.py @@ -551,6 +551,8 @@ def object_from_message(message, queue, logger): if not name: ext = mimetypes.guess_extension(part.get_content_type()) name = "part-%i%s" % (counter, ext) + else: + name = ("part-%i_" % counter) + name # FIXME: this code gets the paylods, then does something with it and then completely ignores it # writing the part.get_payload(decode=True) instead; and then the payload variable is