From d0e7119722e8ff375d53194e9c292dfc9390ea70 Mon Sep 17 00:00:00 2001 From: Henri Rosten Date: Mon, 12 Feb 2024 16:37:34 +0200 Subject: [PATCH] utils: Fix potentially invalid version 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 --- src/common/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/utils.py b/src/common/utils.py index 15c1e0f..d468e9c 100644 --- a/src/common/utils.py +++ b/src/common/utils.py @@ -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: