inspect: change additional spdxs to not have duplicates

Signed-off-by: Justin Chadwell <me@jedevc.com>
(cherry picked from commit 484823c97d)
pull/1501/head
Justin Chadwell 2 years ago committed by Tonis Tiigi
parent 9d4f38c5fa
commit 9fb3ff1a27
No known key found for this signature in database
GPG Key ID: AFA9DE5F8AB7AF39

@ -256,7 +256,7 @@ func (l *loader) scanConfig(ctx context.Context, fetcher remotes.Fetcher, desc o
type sbomStub struct { type sbomStub struct {
SPDX interface{} `json:",omitempty"` SPDX interface{} `json:",omitempty"`
SPDXs []interface{} `json:",omitempty"` AdditionalSPDXs []interface{} `json:",omitempty"`
} }
func (l *loader) scanSBOM(ctx context.Context, fetcher remotes.Fetcher, r *result, refs []digest.Digest, as *asset) error { func (l *loader) scanSBOM(ctx context.Context, fetcher remotes.Fetcher, r *result, refs []digest.Digest, as *asset) error {
@ -286,8 +286,9 @@ func (l *loader) scanSBOM(ctx context.Context, fetcher remotes.Fetcher, r *resul
if as.sbom == nil { if as.sbom == nil {
as.sbom = &sbomStub{} as.sbom = &sbomStub{}
as.sbom.SPDX = spdx.Predicate as.sbom.SPDX = spdx.Predicate
} else {
as.sbom.AdditionalSPDXs = append(as.sbom.AdditionalSPDXs, spdx.Predicate)
} }
as.sbom.SPDXs = append(as.sbom.SPDXs, spdx.Predicate)
} }
} }
} }

Loading…
Cancel
Save