Skip to content

Commit

Permalink
find type by purl
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Zantow <[email protected]>
  • Loading branch information
kzantow committed Feb 10, 2022
1 parent 0c70244 commit 275e7c4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions internal/formats/common/cyclonedxhelpers/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,25 @@ func decodeComponent(c *cyclonedx.Component) (*pkg.Package, error) {
if err != nil {
return nil, err
}

typ := pkg.Type(prop(c, "type"))
purl := c.PackageURL
if typ == "" {
if purl != "" {
typ = pkg.TypeFromPURL(purl)
}
}

p := &pkg.Package{
Name: c.Name,
Version: c.Version,
FoundBy: prop(c, "foundBy"),
Locations: nil,
Licenses: decodeLicenses(c),
Language: pkg.Language(prop(c, "language")),
Type: pkg.Type(prop(c, "type")),
Type: pkg.Type(typ),
CPEs: cp,
PURL: c.PackageURL,
PURL: purl,
}

metaType, meta, err := decodePackageMetadata(c)
Expand Down

0 comments on commit 275e7c4

Please sign in to comment.