Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Jun 28, 2024
1 parent 90f88ad commit c4c413a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/sbom/io/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,9 @@ func (e *Encoder) rootComponent(r types.Report) (*core.Component, error) {
root.Type = core.TypeRepository
case artifact.TypeCycloneDX, artifact.TypeSPDX:
// When we scan SBOM file
if r.BOM != nil {
// If SBOM file doesn't contain root component - use filesystem
if bomRoot := r.BOM.Root(); bomRoot != nil {
return bomRoot, nil
}
// If SBOM file doesn't contain root component - use filesystem
if r.BOM != nil && r.BOM.Root() != nil {
return r.BOM.Root(), nil
}
// When we scan a `json` file (meaning a file in `json` format) which was created from the SBOM file.
// e.g. for use in `convert` mode.
Expand Down

0 comments on commit c4c413a

Please sign in to comment.