[PATCH 5/5] series: fix obvious breakage for patches with ']' in the name

Sean Farley sean at farley.io
Wed Jul 12 04:41:39 AEST 2017


This copies the same regex that parse uses to find the name. Perhaps future
work should abstract this into a common method.

Signed-off-by: Sean Farley <sean at farley.io>
---
 patchwork/models.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/patchwork/models.py b/patchwork/models.py
index e1350c2..03109d3 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -619,7 +619,11 @@ class Series(FilenameMixin, models.Model):
 
     @staticmethod
     def _format_name(obj):
-        return obj.name.split(']')[-1].strip()
+        prefix_re = re.compile(r'^\[([^\]]*)\]\s*(.*)$')
+        match = prefix_re.match(obj.name)
+        if match:
+            return match.group(2)
+        return obj.name.strip()
 
     @property
     def received_total(self):
-- 
2.13.2



More information about the Patchwork mailing list