updating dist

This commit is contained in:
Federico Builes
2023-10-30 09:31:26 +01:00
parent c8515ab391
commit 3c1cb72dcd
2 changed files with 22 additions and 2 deletions
Generated Vendored
+21 -1
View File
@@ -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;
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long