Skip to content

Commit a03cbc9

Browse files
authored
fix: properly handle comparing zero versions in Maven (#173)
1 parent cc0ea00 commit a03cbc9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pkg/semantic/fixtures/maven-versions.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,16 @@
108108
123456789012345.1H.5-beta < 12345678901234567890.1H.5-beta
109109
1234567890.12345 < 12345678901234567890.1H.5-beta
110110
20190126.230843 < 12345678901234567890.1H.5-beta
111+
112+
# https://github.com/google/osv.dev/pull/1021
113+
0.0.0 = 0.0
114+
0.0.0 = 0
115+
0.0 = 0
116+
0 = 0
117+
118+
0.0.0-0.0.0 = 0-final-ga
119+
0.0.0-0.0.0 = 0
120+
0-final-ga = 0
121+
122+
0 < 1
123+
0.0.0-2021-05-17T01-01-51-5ec03a8b < 20.0.0

pkg/semantic/version-maven.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ func newMavenVersion(str string) MavenVersion {
283283

284284
i := len(tokens) - 1
285285

286-
for i >= 0 {
286+
for i > 0 {
287287
if tokens[i].shouldTrim() {
288288
tokens = append(tokens[:i], tokens[i+1:]...)
289289
i--

0 commit comments

Comments
 (0)