Merge pull request #2922 from github/mbg/fix/sanitizeArtifactName

Fix backslashes being accepted by `sanitizeArtifactName`
This commit is contained in:
Michael B. Gale
2025-06-04 21:46:46 +01:00
committed by GitHub
6 changed files with 9 additions and 4 deletions

View File

@@ -18,6 +18,10 @@ test("sanitizeArtifactName", (t) => {
debugArtifacts.sanitizeArtifactName("*m)a&n^y%i££n+v!a:l[i]d"),
"manyinvalid",
);
t.deepEqual(
debugArtifacts.sanitizeArtifactName("\\foo\\bar//baz"),
"foobarbaz",
);
});
// These next tests check the correctness of the logic to determine whether or not

View File

@@ -28,7 +28,7 @@ import {
} from "./util";
export function sanitizeArtifactName(name: string): string {
return name.replace(/[^a-zA-Z0-9_\\-]+/g, "");
return name.replace(/[^a-zA-Z0-9_-]+/g, "");
}
/**