File tree Expand file tree Collapse file tree 2 files changed +2
-10
lines changed Expand file tree Collapse file tree 2 files changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ package ecosystems
1919import (
2020 "context"
2121 "fmt"
22- "net/url"
2322
2423 "github.com/package-url/packageurl-go"
2524
@@ -84,16 +83,10 @@ func purlToEcosystemsName(purl packageurl.PackageURL) string {
8483 case packageurl .TypeMaven :
8584 name = fmt .Sprintf ("%s:%s" , purl .Namespace , purl .Name )
8685
87- // ecosyste.ms npm requires the combination of namespace and name to
88- // be URL-encoded, including the separator.
89- case packageurl .TypeNPM :
90- name = url .QueryEscape (fmt .Sprintf ("%s/%s" , purl .Namespace , purl .Name ))
91-
9286 // apk packages are only used by alpine, so the namespace isn't used in the
9387 // package name for the ecosyste.ms API
9488 case packageurl .TypeApk :
9589 break
9690 }
97-
9891 return name
9992}
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ package ecosystems
1818
1919import (
2020 "fmt"
21- "net/url"
2221 "testing"
2322
2423 "github.com/jarcoal/httpmock"
@@ -89,8 +88,8 @@ func TestPurlToEcosystemsName(t *testing.T) {
8988 // Test case 1: When the package manager type is "npm"
9089 // and the namespace is not empty, the function should return
9190 // a url encoded string in the form of "<namespace>/<name>"
92- purlStr : "pkg:npm/my -namespace/my-package" ,
93- expectedName : url . QueryEscape ( " my-namespace/my-package") ,
91+ purlStr : "pkg:npm/%40my -namespace/my-package" ,
92+ expectedName : "@ my-namespace/my-package" ,
9493 },
9594 {
9695 // Test case 2: When the package manager type is "npm"
You can’t perform that action at this time.
0 commit comments