Skip to content

Commit

Permalink
make sure all chars are replaced, fix issue anchore#396
Browse files Browse the repository at this point in the history
Signed-off-by: lts-po <philip@supernetworks.org>
  • Loading branch information
lts-po committed May 3, 2023
1 parent ea7104d commit 2be1457
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/attachReleaseAssets/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/downloadSyft/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/runSyftAction/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/github/SyftGithubAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function getArtifactName(): string {
if (parts.length > 2) {
parts.splice(0, 1);
}
const prefix = parts.join("-").replace(/[^-a-zA-Z0-9]/, "_");
const prefix = parts.join("-").replace(/[^-a-zA-Z0-9]/g, "_");
return `${prefix}.${extension}`;
}

Expand Down
11 changes: 11 additions & 0 deletions tests/SyftGithubAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,17 @@ describe("Action", () => {
});

expect(action.getArtifactName()).toBe("img.cyclonedx.json");

});

it("correctly encode tags", () => {
setData({
inputs: {
image: "ghcr.io/something-something/image-image:0.1.2-dev"
}
});

expect(action.getArtifactName()).toBe("something-something-image-image_0_1_2-dev.spdx.json");
});

it ("properly maps paths for WSL", () => {
Expand Down

0 comments on commit 2be1457

Please sign in to comment.