diff --git a/lib/ecosystems/package.go b/lib/ecosystems/package.go index f1fe70c..0947444 100644 --- a/lib/ecosystems/package.go +++ b/lib/ecosystems/package.go @@ -19,7 +19,6 @@ package ecosystems import ( "context" "fmt" - "net/url" "github.com/package-url/packageurl-go" @@ -84,16 +83,10 @@ func purlToEcosystemsName(purl packageurl.PackageURL) string { case packageurl.TypeMaven: name = fmt.Sprintf("%s:%s", purl.Namespace, purl.Name) - // 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 9f33f9e..e1390bf 100644 --- a/lib/ecosystems/package_test.go +++ b/lib/ecosystems/package_test.go @@ -18,7 +18,6 @@ package ecosystems import ( "fmt" - "net/url" "testing" "github.com/jarcoal/httpmock" @@ -89,8 +88,8 @@ func TestPurlToEcosystemsName(t *testing.T) { // Test case 1: When the package manager type is "npm" // and the namespace is not empty, the function should return // a url encoded string in the form of "/" - purlStr: "pkg:npm/my-namespace/my-package", - expectedName: url.QueryEscape("my-namespace/my-package"), + purlStr: "pkg:npm/%40my-namespace/my-package", + expectedName: "@my-namespace/my-package", }, { // Test case 2: When the package manager type is "npm"