Skip to content

Commit

Permalink
fix: properly handle comparing zero versions in Maven (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Mar 3, 2023
1 parent cc0ea00 commit a03cbc9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions pkg/semantic/fixtures/maven-versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,16 @@
123456789012345.1H.5-beta < 12345678901234567890.1H.5-beta
1234567890.12345 < 12345678901234567890.1H.5-beta
20190126.230843 < 12345678901234567890.1H.5-beta

# https://github.com/google/osv.dev/pull/1021
0.0.0 = 0.0
0.0.0 = 0
0.0 = 0
0 = 0

0.0.0-0.0.0 = 0-final-ga
0.0.0-0.0.0 = 0
0-final-ga = 0

0 < 1
0.0.0-2021-05-17T01-01-51-5ec03a8b < 20.0.0
2 changes: 1 addition & 1 deletion pkg/semantic/version-maven.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func newMavenVersion(str string) MavenVersion {

i := len(tokens) - 1

for i >= 0 {
for i > 0 {
if tokens[i].shouldTrim() {
tokens = append(tokens[:i], tokens[i+1:]...)
i--
Expand Down

0 comments on commit a03cbc9

Please sign in to comment.