Removal of all punctuations from filename #875

This commit is contained in:
Elio Struyf
2024-10-23 13:10:33 +02:00
parent 8b05da5a76
commit b18f5e1e36

View File

@@ -1,4 +1,4 @@
const illegalRe = /[/?<>\\:*|"!]/g;
const illegalRe = /[/?<>\\:*|"!.,;{}[\]()_+=~`@#$%^&]/g;
// eslint-disable-next-line no-control-regex
const controlRe = /[\x00-\x1f\x80-\x9f]/g;
const reservedRe = /^\.+$/;
@@ -9,6 +9,7 @@ function sanitize(input: string, replacement: string) {
if (typeof input !== 'string') {
throw new Error('Input must be string');
}
const sanitized = input
.replace(illegalRe, replacement)
.replace(controlRe, replacement)