diff --git a/lib/ecosystems/package.go b/lib/ecosystems/package.go index d90f3ea..f1fe70c 100644 --- a/lib/ecosystems/package.go +++ b/lib/ecosystems/package.go @@ -79,15 +79,20 @@ func purlToEcosystemsName(purl packageurl.PackageURL) string { default: name = fmt.Sprintf("%s/%s", purl.Namespace, purl.Name) - // Ecosystem maven requires the group ID and artifact ID to be separated + // ecosyste.ms maven requires the group ID and artifact ID to be separated // by a colon ":", case packageurl.TypeMaven: name = fmt.Sprintf("%s:%s", purl.Namespace, purl.Name) - // Ecosystem npm requires the combination of namespace and name to + // ecosyste.ms npm requires the combination of namespace and name to // be URL-encoded, including the separator. case packageurl.TypeNPM: name = url.QueryEscape(fmt.Sprintf("%s/%s", purl.Namespace, purl.Name)) + + // apk packages are only used by alpine, so the namespace isn't used in the + // package name for the ecosyste.ms API + case packageurl.TypeApk: + break } return name diff --git a/lib/ecosystems/package_test.go b/lib/ecosystems/package_test.go index e9ff403..9f33f9e 100644 --- a/lib/ecosystems/package_test.go +++ b/lib/ecosystems/package_test.go @@ -132,6 +132,11 @@ func TestPurlToEcosystemsName(t *testing.T) { purlStr: "pkg:swift/github.com/yonaskolb/XcodeGen@1", expectedName: "github.com/yonaskolb/XcodeGen", }, + { + // Test case 8: When the package manager type is "apk" + purlStr: "pkg:apk/alpine/lf@30-r3", + expectedName: "lf", + }, } for _, testCase := range testCases {