From 8323c9dd4895694df4070d13ae14dc9f7dcdd34d Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Tue, 24 Sep 2024 22:55:49 +0200 Subject: [PATCH] Accept a Message-ID contained in < > characters At least GMail will show the Message-ID including the < > characters. --- django/archives/mailarchives/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/archives/mailarchives/views.py b/django/archives/mailarchives/views.py index bf3336e..69172bd 100644 --- a/django/archives/mailarchives/views.py +++ b/django/archives/mailarchives/views.py @@ -769,11 +769,12 @@ def search(request): # Ok, we have all we need to do the search if query.find('@') > 0: + cleaned_id = query.strip().removeprefix('<').removesuffix('>') # This could be a messageid. So try to get that one specifically first. # We don't do a more specific check if it's a messageid because doing # a key lookup is cheap... curs.execute("SELECT messageid FROM messages WHERE messageid=%(q)s", { - 'q': query, + 'q': cleaned_id, }) a = curs.fetchall() if len(a) == 1: -- 2.30.2