From 6a0b367171d9fad4557bdf06def065512a5c7b26 Mon Sep 17 00:00:00 2001 From: Brendan Wood Date: Thu, 23 Sep 2021 10:07:12 -0300 Subject: [PATCH] fix: strip extraneous whitespace characters that are returned in the Message-ID and In-Reply-To fields from some email providers --- helpdesk/email.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helpdesk/email.py b/helpdesk/email.py index fcbb3b08..998ebb96 100644 --- a/helpdesk/email.py +++ b/helpdesk/email.py @@ -362,6 +362,12 @@ def create_object_from_email_message(message, ticket_id, payload, files, logger) message_id = message.get('Message-Id') in_reply_to = message.get('In-Reply-To') + if message_id: + message_id = message_id.strip() + + if in_reply_to: + in_reply_to = in_reply_to.strip() + if in_reply_to is not None: try: queryset = FollowUp.objects.filter(message_id=in_reply_to).order_by('-date')