Skip to content
Snippets Groups Projects
Unverified Commit 3a9aeb0f authored by RahulGautamSingh's avatar RahulGautamSingh Committed by GitHub
Browse files

fix: match source url prefixes compares case insensitive (#12896)

parent dc9b5a05
No related branches found
No related tags found
No related merge requests found
...@@ -733,4 +733,25 @@ describe('util/package-rules', () => { ...@@ -733,4 +733,25 @@ describe('util/package-rules', () => {
const res = applyPackageRules(config); const res = applyPackageRules(config);
expect(res.groupSlug).toBe('b'); expect(res.groupSlug).toBe('b');
}); });
it('matches matchSourceUrlPrefixes(case-insensitive)', () => {
const config: TestConfig = {
packageRules: [
{
matchSourceUrlPrefixes: [
'https://github.com/foo/bar',
'https://github.com/Renovatebot/',
],
x: 1,
},
],
};
const dep = {
depType: 'dependencies',
depName: 'a',
updateType: 'patch' as UpdateType,
sourceUrl: 'https://github.com/renovatebot/Presets',
};
const res = applyPackageRules({ ...config, ...dep });
expect(res.x).toBe(1);
});
}); });
...@@ -194,8 +194,9 @@ function matchesRule( ...@@ -194,8 +194,9 @@ function matchesRule(
positiveMatch = true; positiveMatch = true;
} }
if (matchSourceUrlPrefixes.length) { if (matchSourceUrlPrefixes.length) {
const upperCaseSourceUrl = sourceUrl?.toUpperCase();
const isMatch = matchSourceUrlPrefixes.some((prefix) => const isMatch = matchSourceUrlPrefixes.some((prefix) =>
sourceUrl?.startsWith(prefix) upperCaseSourceUrl?.startsWith(prefix.toUpperCase())
); );
if (!isMatch) { if (!isMatch) {
return false; return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment