Skip to content

Commit

Permalink
fix: handle comma-separated websites in ecosyste.ms enrichment (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
acidghost authored Nov 20, 2024
1 parent 327a30a commit 5e753b3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/ecosystems/enrich_cyclonedx.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package ecosystems

import (
"strings"
"time"

cdx "github.com/CycloneDX/cyclonedx-go"
Expand Down Expand Up @@ -160,8 +161,11 @@ func enrichCDXSupplier(comp *cdx.Component, data *packages.Package) {
Name: name,
}
if website, ok := ownerRecord["website"].(string); ok {
websites := []string{website}
supplier.URL = &websites
split := strings.Split(website, ", ")
for i := range split {
split[i] = strings.TrimSpace(split[i])
}
supplier.URL = &split
}
comp.Supplier = &supplier
}
Expand All @@ -175,7 +179,9 @@ func enrichCDXTopics(comp *cdx.Component, data *packages.Package) {

if topics, ok := meta["topics"].([]interface{}); ok {
for _, topic := range topics {
enrichProperty(comp, "ecosystems:topic", topic.(string))
if s, ok := topic.(string); ok {
enrichProperty(comp, "ecosystems:topic", s)
}
}
}
}
Expand Down

0 comments on commit 5e753b3

Please sign in to comment.