Validate packageUrlJson structure in makePackageUrl method
This commit is contained in:
+5
-1
@@ -36132,7 +36132,11 @@ class ComponentDetection {
|
||||
}
|
||||
static makePackageUrl(packageUrlJson) {
|
||||
// Handle case when packageUrlJson is null or undefined
|
||||
if (!packageUrlJson) {
|
||||
if (!packageUrlJson ||
|
||||
typeof packageUrlJson.Scheme !== 'string' ||
|
||||
typeof packageUrlJson.Type !== 'string' ||
|
||||
!packageUrlJson.Scheme ||
|
||||
!packageUrlJson.Type) {
|
||||
core.debug(`Warning: Received null or undefined packageUrlJson. Unable to create package URL.`);
|
||||
return ""; // Return a blank string for unknown packages
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user