Skip to content

Commit 72e2aea

Browse files
committed
implement diff with bomref
1 parent 9456278 commit 72e2aea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

utils/formats/cdxutils/cyclonedxutils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,12 @@ func SearchComponentByRef(components *[]cyclonedx.Component, ref string) (compon
260260
return
261261
}
262262

263-
func SearchComponentByCleanPurl(components *[]cyclonedx.Component, purl string) (component *cyclonedx.Component) {
263+
func SearchComponentByCleanRef(components *[]cyclonedx.Component, bomRef string) (component *cyclonedx.Component) {
264264
if components == nil || len(*components) == 0 {
265265
return
266266
}
267267
for i, comp := range *components {
268-
if techutils.PurlToXrayComponentId(comp.PackageURL) == techutils.PurlToXrayComponentId(purl) {
268+
if techutils.PurlToXrayComponentId(comp.BOMRef) == techutils.PurlToXrayComponentId(bomRef) {
269269
return &(*components)[i]
270270
}
271271
}
@@ -321,7 +321,7 @@ func Exclude(bom cyclonedx.BOM, componentsToExclude ...cyclonedx.Component) (fil
321321
}
322322
filteredSbom = &bom
323323
for _, compToExclude := range componentsToExclude {
324-
if matchedBomComp := SearchComponentByCleanPurl(bom.Components, compToExclude.BOMRef); matchedBomComp == nil || GetComponentRelation(&bom, matchedBomComp.BOMRef, false) == RootRelation {
324+
if matchedBomComp := SearchComponentByCleanRef(bom.Components, compToExclude.BOMRef); matchedBomComp == nil || GetComponentRelation(&bom, matchedBomComp.BOMRef, false) == RootRelation {
325325
// If not a match or Root component, skip it
326326
continue
327327
}

0 commit comments

Comments
 (0)