diff mbox

[2/4] parser: Strip whitespace from references

Message ID 20170524060224.8296-3-stephen@that.guru
State Accepted
Headers show

Commit Message

Stephen Finucane May 24, 2017, 6:02 a.m. UTC
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@that.guru>
---
 patchwork/parser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

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()
         rs.reverse()
         for r in rs:
             if r not in refs:
-                refs.append(r)
+                refs.append(r.strip())
 
     return refs