Skip to content
Snippets Groups Projects
Unverified Commit 58c9b151 authored by Johannes Feichtner's avatar Johannes Feichtner Committed by GitHub
Browse files

fix(manager/gradle): only accept known format for optional classifiers (#18525)

parent 8f546ea2
No related branches found
No related tags found
No related merge requests found
......@@ -39,12 +39,14 @@ describe('modules/manager/gradle/utils', () => {
expect(isDependencyString('foo.foo:bar.bar:1.2.3')).toBeTrue();
expect(isDependencyString('foo:bar:baz:qux')).toBeTrue();
expect(isDependencyString('foo.bar:baz:1.2.3')).toBeTrue();
expect(isDependencyString('foo.bar:baz:1.2.3:linux-cpu-x86_64')).toBeTrue();
expect(isDependencyString('foo.bar:baz:1.2.+')).toBeTrue();
expect(isDependencyString('foo:bar:baz:qux:quux')).toBeFalse();
expect(isDependencyString("foo:bar:1.2.3'")).toBeFalse();
expect(isDependencyString('foo:bar:1.2.3"')).toBeFalse();
expect(isDependencyString('-Xep:ParameterName:OFF')).toBeFalse();
expect(isDependencyString('foo$bar:baz:1.2.+')).toBeFalse();
expect(isDependencyString('scm:git:https://some.git')).toBeFalse();
});
it('parseDependencyString', () => {
......
......@@ -30,7 +30,13 @@ export function isDependencyString(input: string): boolean {
return false;
}
// eslint-disable-next-line prefer-const
let [tempGroupId, tempArtifactId, tempVersionPart] = split;
let [tempGroupId, tempArtifactId, tempVersionPart, optionalClassifier] =
split;
if (optionalClassifier && !artifactRegex.test(optionalClassifier)) {
return false;
}
if (
tempVersionPart !== versionLikeSubstring(tempVersionPart) &&
tempVersionPart.includes('@')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment