Skip to content

Commit 25dd677

Browse files
shinoCopilot
andcommitted
Update contrib/trivy/pkg/converter.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 69b3d76 commit 25dd677

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

contrib/trivy/pkg/converter.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,11 @@ func Convert(results types.Results, artifactType ftypes.ArtifactType, artifactNa
200200

201201
if existing, ok := pkgs[p.Name]; ok {
202202
if existing.Version != pv {
203-
if _, seen := dupPkgs[p.Name]; !seen {
204-
dupPkgs[p.Name] = []string{existing.Version}
203+
if versions, seen := dupPkgs[p.Name]; !seen {
204+
dupPkgs[p.Name] = []string{existing.Version, pv}
205+
} else if !slices.Contains(versions, pv) {
206+
dupPkgs[p.Name] = append(versions, pv)
205207
}
206-
dupPkgs[p.Name] = append(dupPkgs[p.Name], pv)
207208
}
208209
if compareVersions(trivyResult.Type, pv, existing.Version) >= 0 {
209210
pkgs[p.Name] = models.Package{

0 commit comments

Comments
 (0)