Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(maven): Avoid range downgrades (#6711)
  • Loading branch information
zharinov committed Jul 8, 2020
1 parent 4665dbf commit 20059d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/versioning/maven/compare.ts
Expand Up @@ -520,8 +520,10 @@ function autoExtendMavenRange(
rightValue !== null &&
incrementRangeValue(leftValue) === rightValue
) {
interval.leftValue = coerceRangeValue(leftValue, newValue);
interval.rightValue = incrementRangeValue(interval.leftValue);
if (compare(newValue, leftValue) !== -1) {
interval.leftValue = coerceRangeValue(leftValue, newValue);
interval.rightValue = incrementRangeValue(interval.leftValue);
}
} else if (rightValue !== null) {
if (interval.rightType === INCLUDING_POINT) {
const tokens = tokenize(rightValue);
Expand Down
2 changes: 1 addition & 1 deletion lib/versioning/maven/index.spec.ts
Expand Up @@ -257,7 +257,7 @@ describe('versioning/maven/compare', () => {
['[1.2.3,)', '1.2.4', '[1.2.4,)'],
['[1.2.3,[', '1.2.4', '[1.2.4,['],
['[1.2.3,]', '1.2.4', '[1.2.3,]'], // invalid range
['[0.21,0.22)', '0.20.21', '[0.20,0.21)'],
['[0.21,0.22)', '0.20.21', '[0.21,0.22)'],
['[0.21,0.22)', '0.21.1', '[0.21,0.22)'],
['[0.21,0.22.0)', '0.22.1', '[0.21,0.22.2)'],
['[0.21,0.22)', '0.23', '[0.23,0.24)'],
Expand Down

0 comments on commit 20059d9

Please sign in to comment.