Make purl comparisons case insensitive

This commit is contained in:
Justin Holguín
2026-02-20 22:01:04 +00:00
committed by GitHub
parent b49f407d39
commit 8cf743c0ea
4 changed files with 40 additions and 7 deletions
Generated Vendored
+12 -4
View File
@@ -1151,11 +1151,15 @@ function fullName(purl) {
// namespace/name splits. This handles the case where a PURL like
// 'pkg:npm/%40scope%2Fname' is parsed as {namespace: null, name: '@scope/name'}
// while 'pkg:npm/%40scope/name' is parsed as {namespace: '@scope', name: 'name'}.
//
// The comparison is case-insensitive because most ecosystems and registries
// treat names that way (npm, PyPI, GitHub org/repo names, etc.).
function purlsMatch(a, b) {
if (a.type !== b.type) {
var _a, _b;
if (a.type.toLowerCase() !== b.type.toLowerCase()) {
return false;
}
return fullName(a) === fullName(b);
return ((_a = fullName(a)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = fullName(b)) === null || _b === void 0 ? void 0 : _b.toLowerCase());
}
@@ -98064,11 +98068,15 @@ function fullName(purl) {
// namespace/name splits. This handles the case where a PURL like
// 'pkg:npm/%40scope%2Fname' is parsed as {namespace: null, name: '@scope/name'}
// while 'pkg:npm/%40scope/name' is parsed as {namespace: '@scope', name: 'name'}.
//
// The comparison is case-insensitive because most ecosystems and registries
// treat names that way (npm, PyPI, GitHub org/repo names, etc.).
function purlsMatch(a, b) {
if (a.type !== b.type) {
var _a, _b;
if (a.type.toLowerCase() !== b.type.toLowerCase()) {
return false;
}
return fullName(a) === fullName(b);
return ((_a = fullName(a)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = fullName(b)) === null || _b === void 0 ? void 0 : _b.toLowerCase());
}
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long