mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
fix: only generate PURL on empty string (#1312)
This commit is contained in:
parent
e0acfa98c7
commit
10464642e9
@ -45,9 +45,7 @@ func newMonitor() (*progress.Manual, *progress.Manual) {
|
||||
func Catalog(resolver source.FileResolver, release *linux.Release, catalogers ...pkg.Cataloger) (*pkg.Catalog, []artifact.Relationship, error) {
|
||||
catalog := pkg.NewCatalog()
|
||||
var allRelationships []artifact.Relationship
|
||||
|
||||
filesProcessed, packagesDiscovered := newMonitor()
|
||||
|
||||
// perform analysis, accumulating errors for each failed analysis
|
||||
var errs error
|
||||
for _, c := range catalogers {
|
||||
@ -70,7 +68,9 @@ func Catalog(resolver source.FileResolver, release *linux.Release, catalogers ..
|
||||
p.CPEs = append(p.CPEs, cpe.Generate(p)...)
|
||||
|
||||
// generate PURL (note: this is excluded from package ID, so is safe to mutate)
|
||||
p.PURL = pkg.URL(p, release)
|
||||
if p.PURL == "" {
|
||||
p.PURL = pkg.URL(p, release)
|
||||
}
|
||||
|
||||
// if we were not able to identify the language we have an opportunity
|
||||
// to try and get this value from the PURL. Worst case we assert that
|
||||
@ -86,7 +86,6 @@ func Catalog(resolver source.FileResolver, release *linux.Release, catalogers ..
|
||||
} else {
|
||||
allRelationships = append(allRelationships, owningRelationships...)
|
||||
}
|
||||
// add to catalog
|
||||
catalog.Add(p)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user