From 0b306aef97af47ab3901b26ac49a0e69e8bca1d2 Mon Sep 17 00:00:00 2001 From: Federico Builes Date: Wed, 31 May 2023 16:14:02 +0200 Subject: [PATCH] Don't try to create PURLs from empty strings. --- src/licenses.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/licenses.ts b/src/licenses.ts index 859234fed..04a767fb3 100644 --- a/src/licenses.ts +++ b/src/licenses.ts @@ -41,6 +41,10 @@ export async function getInvalidLicenseChanges( // Takes the changes from the groupedChanges object and filters out the ones that are part of the exclusions list // It does by creating a new PackageURL object from the change and comparing it to the exclusions list groupedChanges.licensed = groupedChanges.licensed.filter(change => { + if (change.package_url.length === 0) { + return true + } + const changeAsPackageURL = PackageURL.fromString(change.package_url) // We want to find if the licenseExclussion list contains the PackageURL of the Change @@ -56,8 +60,9 @@ export async function getInvalidLicenseChanges( ) !== -1 ) { return false + } else { + return true } - return true }) const licensedChanges: Changes = groupedChanges.licensed