Skip to content

Commit

Permalink
utils: Fix potentially invalid version
Browse files Browse the repository at this point in the history
Fix an issue with utils.py:parse_version, which could
result passing an invalid version string to
packaging.version.parse potentially throwing an invalid
version exception.

Signed-off-by: Henri Rosten <[email protected]>
  • Loading branch information
henrirosten committed Feb 15, 2024
1 parent bbfe094 commit d0e7119
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def parse_version(ver_str):
return None
ver_beg = match.group("ver_beg").rstrip(".")
ver_end = match.group("ver_end")
ver_end = re.sub(r"[^0-9.]+", "", ver_end)
ver_end = re.sub(r"[^0-9.]+", "", ver_end).lstrip(".")
if ver_end:
ver_end = f"+{ver_end}"
else:
Expand Down

0 comments on commit d0e7119

Please sign in to comment.