[PATCH 2/4] parser: Strip whitespace from references

Stephen Finucane stephen at that.guru
Wed May 24 16:02:22 AEST 2017

Some mail, particularly those generated with older versions of
git-send-email or written by hand, include some extra whitespace in the
'References' and 'In-Reply-To' lines. Ensure we always strip this,
preventing mismatches between this and 'Message-ID', which is already
stripped of whitespace, when looking up SeriesReference's.

Signed-off-by: Stephen Finucane <stephen at that.guru>
 patchwork/parser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/patchwork/parser.py b/patchwork/parser.py
index 28b3a07..d7941e3 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -339,14 +339,14 @@ def find_references(mail):
     refs = []
     if 'In-Reply-To' in mail:
-        refs.append(mail.get('In-Reply-To'))
+        refs.append(mail.get('In-Reply-To').strip())
     if 'References' in mail:
         rs = mail.get('References').split()
         for r in rs:
             if r not in refs:
-                refs.append(r)
+                refs.append(r.strip())
     return refs

More information about the Patchwork mailing list