chiark / gitweb /
Handle multi-line Subject header better
authorCatalin Marinas <catalin.marinas@arm.com>
Mon, 20 Jul 2009 09:16:22 +0000 (10:16 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Mon, 20 Jul 2009 09:16:57 +0000 (10:16 +0100)
It looks like not all multi-line Subject headers are split with \n\t.
This is causing an exception with the re.findall() calll in
stgit.commands.common.parse_mail() function. Use re.sub() instead of
replace().

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
stgit/commands/common.py

index bc8266e0ae07dcb1cec9544b6130fdadcb7382a5..23ba4b32852144dd1dd706bac841b52f1ea71e24 100644 (file)
@@ -405,7 +405,8 @@ def parse_mail(msg):
         authname = authemail = None
 
     # '\n\t' can be found on multi-line headers
-    descr = __decode_header(msg['subject']).replace('\n\t', ' ')
+    descr = __decode_header(msg['subject'])
+    descr = re.sub('\n[ \t]*', ' ', descr)
     authdate = msg['date']
 
     # remove the '[*PATCH*]' expression in the subject