Skip to content

Commit 55039df

Browse files
committed
Fix EVR regex to not match email addresses with - in them
1 parent c0a98a8 commit 55039df

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

specfile/changelog.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ def evr(self) -> Optional[str]:
8888
m = re.match(
8989
r"""
9090
^.*
91-
\s+ # preceding whitespace
92-
((?P<sb>\[)|(?P<rb>\())? # optional opening bracket
93-
(?P<evr>(\d+:)?\S+-\S+?) # EVR
94-
(?(sb)\]|(?(rb)\))) # matching closing bracket
95-
:? # optional colon
96-
\s* # optional following whitespace
91+
\s+ # preceding whitespace
92+
((?P<sb>\[)|(?P<rb>\())? # optional opening bracket
93+
(?P<evr>(\d+:)?(\d+\.)\S*-\S+?) # EVR
94+
(?(sb)\]|(?(rb)\))) # matching closing bracket
95+
:? # optional colon
96+
\s* # optional following whitespace
9797
$
9898
""",
9999
self.header,

tests/unit/test_changelog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"header, evr",
1515
[
1616
("* Thu Jan 04 2007 Michael Schwendt <mschwendt@fedoraproject.org>", None),
17+
("* Thu Jan 04 2007 Michael Schwendt <mschwendt@fedora-project.org>", None),
1718
(
1819
"* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> 4.0-0.4.pre2",
1920
"4.0-0.4.pre2",

0 commit comments

Comments
 (0)