Skip to content

Commit 6cb225f

Browse files
committed
Sanitize artifact name for invalid characters
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
1 parent c29e202 commit 6cb225f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

upload-multi-artifact/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ async function run(): Promise<void> {
4444
}
4545

4646
for (const artifact of artifacts) {
47-
console.log(`Uploading artifact ${artifact.name} from ${artifact.path}`);
48-
await client.uploadArtifact(artifact.name, [artifact.path], path.dirname(artifact.path));
47+
// Replace invalid characters in artifact name
48+
const name = artifact.name.replace(/["<>|*?\r\n\\\/]/g, '_');
49+
50+
console.log(`Uploading artifact ${name} from ${artifact.path}`);
51+
await client.uploadArtifact(name, [artifact.path], path.dirname(artifact.path));
4952
}
5053

5154
console.log('Artifact uploads completed');

0 commit comments

Comments
 (0)