]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
parser: subject_check needs to call clean_header
authorDaniel Axtens <dja@axtens.net>
Wed, 28 Sep 2016 04:06:07 +0000 (14:06 +1000)
committerStephen Finucane <stephen@that.guru>
Fri, 7 Oct 2016 18:03:33 +0000 (19:03 +0100)
When testing with headers with unencoded characters on Py3,
subject_check would fail. It was getting an Header class, rather
than a str/bytes, and so the regex was failing.

Run clean_header to decode everything fully first.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
patchwork/parser.py

index 3619a07ef725da4ea8ffa481b1164fa17a8b040c..db3b898c464839e6a58bd14f2b69e7971958e826 100644 (file)
@@ -423,7 +423,7 @@ def subject_check(subject):
     """Determine if a mail is a reply."""
     comment_re = re.compile(r'^(re)[:\s]\s*', re.I)
 
-    return comment_re.match(subject)
+    return comment_re.match(clean_header(subject))
 
 
 def clean_content(content):