Skip to content

Commit

Permalink
Fix: issue 75 version_compare in utils returns incorrect result if mi…
Browse files Browse the repository at this point in the history
…n/max_version is included along with mie/mae

Signed-off-by: Caroline Russell <caroline@appthreat.dev>
  • Loading branch information
cerrussell committed Nov 25, 2023
1 parent 0e65d3a commit 0491ec0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def test_normalise():
def test_version_compare():
res = utils.version_compare("2.0.0", "2.0.0", "3.0.0", "2.0.0", "3.0.0")
assert not res
res = utils.version_compare("3.0.0", "2.0.0", "3.0.0", "2.0.0", "3.0.0")
assert not res
res = utils.version_compare("3.0.0", "2.0.0", "2.7.9.4")
assert not res
res = utils.version_compare("2.0.0", "2.0.0", "2.7.9.4")
Expand Down
4 changes: 2 additions & 2 deletions vdb/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,10 @@ def version_compare(
# Semver compatible and including versions provided
is_min_exclude = False
is_max_exclude = False
if (not min_version or min_version == "*") and mie:
if mie:
min_version = mie
is_min_exclude = True
if (not max_version or max_version == "*") and mae:
if mae:
max_version = mae
is_max_exclude = True
if not min_version:
Expand Down

0 comments on commit 0491ec0

Please sign in to comment.