Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into group-json-output
Browse files Browse the repository at this point in the history
  • Loading branch information
another-rex committed Dec 11, 2022
2 parents 55afa55 + 4452f8c commit 25916f4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/sbom/cyclonedx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sbom

import (
"io"
"strings"

"github.com/CycloneDX/cyclonedx-go"
)
Expand Down Expand Up @@ -35,12 +36,12 @@ func (c *CycloneDX) enumeratePackages(bom *cyclonedx.BOM, callback func(Identifi

func (c *CycloneDX) GetPackages(r io.ReadSeeker, callback func(Identifier) error) error {
var bom cyclonedx.BOM

for _, formatType := range cycloneDXTypes {
r.Seek(0, io.SeekStart)
decoder := cyclonedx.NewBOMDecoder(r, formatType)
err := decoder.Decode(&bom)
if err == nil && bom.BOMFormat == "CycloneDX" {
if err == nil && (bom.BOMFormat == "CycloneDX" || strings.HasPrefix(bom.XMLNS, "http://cyclonedx.org/schema/bom")) {
return c.enumeratePackages(&bom, callback)
}
}
Expand Down

0 comments on commit 25916f4

Please sign in to comment.