diff roundup/mailgw.py @ 7234:86862ed039fa

issue2551262 - make mail gateway subject prefix parsing accept spaces Allow spaces before/after prefix. Also allow spaces between classname and id number in prefix designator. So "[ issue 23 ] subject" is parsed like "[issue23] subject".
author John Rouillard <rouilj@ieee.org>
date Tue, 21 Mar 2023 19:46:38 -0400
parents 8e118eb20d86
children 57f34b0b912c
line wrap: on
line diff
--- a/roundup/mailgw.py	Mon Mar 20 20:05:16 2023 -0400
+++ b/roundup/mailgw.py	Tue Mar 21 19:46:38 2023 -0400
@@ -636,12 +636,12 @@
             tmpsubject = tmpsubject[len(self.matches['quote']):]
 
         # Check if the subject includes a prefix
-        self.has_prefix = re.search(r'^%s(\w+)%s' % (delim_open,
+        self.has_prefix = re.search(r'^%s\s*(\w+)\s*%s' % (delim_open,
                                                      delim_close),
                                     tmpsubject.strip())
 
         # Match the classname if specified
-        class_re = r'%s(?P<classname>(%s))(?P<nodeid>\d+)?%s' %  \
+        class_re = r'%s\s*(?P<classname>(%s))\s*(?P<nodeid>\d+)?\s*%s' %  \
                    (delim_open, "|".join(self.db.getclasses()),
                     delim_close)
         # Note: re.search, not re.match as there might be garbage

Roundup Issue Tracker: http://roundup-tracker.org/