mirror of
https://github.com/anchore/syft.git
synced 2025-11-19 09:23:15 +01:00
Fix package.json parsing for no licenses
Signed-off-by: Dan Luhring <dan.luhring@anchore.com>
This commit is contained in:
parent
fc99538d78
commit
f7be73dbcc
@ -133,6 +133,11 @@ func licenseFromJSON(b []byte) (string, error) {
|
||||
}
|
||||
|
||||
func licensesFromJSON(p PackageJSON) ([]string, error) {
|
||||
if p.License == nil && p.Licenses == nil {
|
||||
// This package.json doesn't specify any licenses whatsoever
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
singleLicense, err := licenseFromJSON(p.License)
|
||||
if err == nil {
|
||||
return []string{singleLicense}, nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user