Skip to content

Commit 5e753b3

Browse files
authored
fix: handle comma-separated websites in ecosyste.ms enrichment (#85)
1 parent 327a30a commit 5e753b3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/ecosystems/enrich_cyclonedx.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package ecosystems
1818

1919
import (
20+
"strings"
2021
"time"
2122

2223
cdx "github.com/CycloneDX/cyclonedx-go"
@@ -160,8 +161,11 @@ func enrichCDXSupplier(comp *cdx.Component, data *packages.Package) {
160161
Name: name,
161162
}
162163
if website, ok := ownerRecord["website"].(string); ok {
163-
websites := []string{website}
164-
supplier.URL = &websites
164+
split := strings.Split(website, ", ")
165+
for i := range split {
166+
split[i] = strings.TrimSpace(split[i])
167+
}
168+
supplier.URL = &split
165169
}
166170
comp.Supplier = &supplier
167171
}
@@ -175,7 +179,9 @@ func enrichCDXTopics(comp *cdx.Component, data *packages.Package) {
175179

176180
if topics, ok := meta["topics"].([]interface{}); ok {
177181
for _, topic := range topics {
178-
enrichProperty(comp, "ecosystems:topic", topic.(string))
182+
if s, ok := topic.(string); ok {
183+
enrichProperty(comp, "ecosystems:topic", s)
184+
}
179185
}
180186
}
181187
}

0 commit comments

Comments
 (0)