Skip to content

Commit 18b183b

Browse files
authored
Merge pull request #37 from jhutchings1/purlfix
Escape the package name
2 parents ca7dbc9 + 0e28c47 commit 18b183b

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

dist/index.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ function searchFiles() {
8888

8989
// Fixes issues with an escaped version string
9090
function replaceVersionEscape(purl) {
91+
// Some tools are failing to escape the namespace, so we will escape it to work around that
92+
purl = purl.replace("/@", "/%40");
93+
9194
//If there's an "@" in the purl, then we don't need to do anything.
9295
if (purl != null && purl != undefined && !purl?.includes("@")) {
9396
let index = purl.lastIndexOf("%40");

test/spdx-example.spdx.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
{
1616
"packageName": "lodash",
1717
"packageVersion": "^ 4.17.21",
18-
"purl": "pkg:NPM/lodash@^ 4.17.21",
18+
"purl": "pkg:NPM/lodash@^4.17.21",
19+
"filesAnalyzed": "false"
20+
},
21+
{
22+
"packageName": "@angular/cli",
23+
"packageVersion": "^ 4.17.21",
24+
"purl": "pkg:NPM/%40angular/cli@^4.17.21",
1925
"filesAnalyzed": "false"
2026
},
2127
{

0 commit comments

Comments
 (0)