From 3c1b181675b0dac14f7b076856152d2b4c4d3a73 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Thu, 1 May 2025 07:47:09 +0800 Subject: [PATCH] fix: enhance version comparison by ignoring suffixes in semantic version strings --- py/routes/update_routes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/py/routes/update_routes.py b/py/routes/update_routes.py index 5b488d55..29996604 100644 --- a/py/routes/update_routes.py +++ b/py/routes/update_routes.py @@ -150,11 +150,16 @@ class UpdateRoutes: """ Compare two semantic version strings Returns True if version2 is newer than version1 + Ignores any suffixes after '-' (e.g., -bugfix, -alpha) """ try: + # Clean version strings - remove any suffix after '-' + v1_clean = version1.split('-')[0] + v2_clean = version2.split('-')[0] + # Split versions into components - v1_parts = [int(x) for x in version1.split('.')] - v2_parts = [int(x) for x in version2.split('.')] + v1_parts = [int(x) for x in v1_clean.split('.')] + v2_parts = [int(x) for x in v2_clean.split('.')] # Ensure both have 3 components (major.minor.patch) while len(v1_parts) < 3: