Skip to content

Commit c4ad0d8

Browse files
seanfarleystephenfin
authored andcommitted
series: fix obvious breakage for patches with ']' in the name
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@farley.io> Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent 6f1f7fa commit c4ad0d8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

patchwork/models.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,15 @@ class Series(FilenameMixin, models.Model):
619619

620620
@staticmethod
621621
def _format_name(obj):
622-
return obj.name.split(']')[-1].strip()
622+
# The parser ensure 'Submission.name' will always take the form
623+
# 'subject' or '[prefix_a,prefix_b,...] subject'. There will never be
624+
# multiple prefixes (text inside brackets), thus, we don't need to
625+
# account for multiple prefixes here.
626+
prefix_re = re.compile(r'^\[([^\]]*)\]\s*(.*)$')
627+
match = prefix_re.match(obj.name)
628+
if match:
629+
return match.group(2)
630+
return obj.name.strip()
623631

624632
@property
625633
def received_total(self):

0 commit comments

Comments
 (0)