updating dist
This commit is contained in:
+21
-1
@@ -25029,6 +25029,12 @@ class PackageURL {
|
||||
_handlePyPi() {
|
||||
this.name = this.name.toLowerCase().replace(/_/g, '-');
|
||||
}
|
||||
_handlePub() {
|
||||
this.name = this.name.toLowerCase();
|
||||
if (!/^[a-z0-9_]+$/i.test(this.name)) {
|
||||
throw new Error('Invalid purl: contains an illegal character.');
|
||||
}
|
||||
}
|
||||
|
||||
toString() {
|
||||
var purl = ['pkg:', encodeURIComponent(this.type), '/'];
|
||||
@@ -25036,6 +25042,9 @@ class PackageURL {
|
||||
if (this.type === 'pypi') {
|
||||
this._handlePyPi();
|
||||
}
|
||||
if (this.type === 'pub') {
|
||||
this._handlePub();
|
||||
}
|
||||
|
||||
if (this.namespace) {
|
||||
purl.push(
|
||||
@@ -25128,7 +25137,18 @@ class PackageURL {
|
||||
let version = null;
|
||||
if (path.includes('@')) {
|
||||
let index = path.indexOf('@');
|
||||
version = decodeURIComponent(path.substring(index + 1));
|
||||
let rawVersion= path.substring(index + 1);
|
||||
version = decodeURIComponent(rawVersion);
|
||||
|
||||
// Convert percent-encoded colons (:) back, to stay in line with the `toString`
|
||||
// implementation of this library.
|
||||
// https://github.com/package-url/packageurl-js/blob/58026c86978c6e356e5e07f29ecfdccbf8829918/src/package-url.js#L98C10-L98C10
|
||||
let versionEncoded = encodeURIComponent(version).replace(/%3A/g, ':');
|
||||
|
||||
if (rawVersion !== versionEncoded) {
|
||||
throw new Error('Invalid purl: version must be percent-encoded');
|
||||
}
|
||||
|
||||
remainder = path.substring(0, index);
|
||||
} else {
|
||||
remainder = path;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user