Skip to content

Commit 9c11ae7

Browse files
dira271641dira271641
authored andcommitted
pkg with no hasfiles but has contains relationship
1 parent 76d9c60 commit 9c11ae7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ bin/sq-windows-386.exe
99
bin/sq-windows-amd64.exe
1010
bin/sq-linux-amd64
1111
ps-sbom.json
12+
sbom_2023-02-24_100502.spdx.json

model/spdx.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,20 @@ func (s *SPDX) getspdxpkg(d int, spdxID string, rel1 Relationships) {
436436
for i, filespdx := range filespdxids {
437437
s.getspdxfile(i, filespdx, SPDXidDetail)
438438
}
439+
} else {
440+
var f int
441+
for _, rel1 := range s.Relationships {
442+
if rel1.SpdxElementID == spdxID {
443+
switch rt := rel1.RelationshipType; rt {
444+
case "CONTAINS":
445+
446+
s.getspdxfile(f, rel1.RelatedSpdxElement, SPDXidDetail)
447+
}
448+
}
449+
}
450+
439451
}
452+
440453
// d++
441454
// nextSPDXid, rel = s.getrelspdxelem(spdxID)
442455
// if nextSPDXid != "" {

0 commit comments

Comments
 (0)