diff --git a/cat_win/src/web/updatechecker.py b/cat_win/src/web/updatechecker.py index 78c2936..5203a98 100644 --- a/cat_win/src/web/updatechecker.py +++ b/cat_win/src/web/updatechecker.py @@ -107,7 +107,7 @@ def only_alpha(_s: str) -> str: only alpha chars and 'z' """ x = 'abcdefghijklmnopqrstuvwxyz' - return ''.join(filter(lambda c: c in x, _s.lower())) + 'z' + return ''.join(filter(lambda c: c in x, _s.lower())) def gen_version_tuples(_v: str, _w: str) -> tuple: @@ -171,6 +171,9 @@ def new_version_available(current_version: str, latest_version: str) -> int: if c_alpha < l_alpha: status = STATUS_PRE_RELEASE_AVAILABLE break + if c_alpha > l_alpha and all(l.isdigit() for l in latest[i-1:]): + status = STATUS_STABLE_RELEASE_AVAILABLE + break if i < len(current): status *= -1 return status diff --git a/cat_win/tests/src/web/test_updatechecker.py b/cat_win/tests/src/web/test_updatechecker.py index 43f5b95..160a9bb 100644 --- a/cat_win/tests/src/web/test_updatechecker.py +++ b/cat_win/tests/src/web/test_updatechecker.py @@ -49,6 +49,7 @@ def test_version_comparison_stable_release(self): self.assertEqual(updatechecker.new_version_available('1.0.12', '1.000.020'), 1) self.assertEqual(updatechecker.new_version_available('v1.0.0', 'v01.00.01'), 1) self.assertEqual(updatechecker.new_version_available('2.1.5a', '2.1.6'), 1) + self.assertEqual(updatechecker.new_version_available('2.1.6a', '2.1.6'), 1) self.assertEqual(updatechecker.new_version_available('v2.1b.5a', '2.1b.051'), 1) def test_version_comparison_pre_release(self): @@ -62,6 +63,7 @@ def test_version_comparison_stable_release_unsafe(self): self.assertEqual(updatechecker.new_version_available('1.0.15', '1.1.9'), -1) self.assertEqual(updatechecker.new_version_available('1.0.9', 'v2.0.9'), -1) self.assertEqual(updatechecker.new_version_available('1.0.12', '1.001.0'), -1) + self.assertEqual(updatechecker.new_version_available('1.10a.0', '1.10.0'), -1) self.assertEqual(updatechecker.new_version_available('v1.0.0', 'v01.001.01'), -1) self.assertEqual(updatechecker.new_version_available('2.1.5a', '2.2.5'), -1)