From b18f5e1e36d3f66eef7edc3dfbcb5530c3085d2f Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Wed, 23 Oct 2024 13:10:33 +0200 Subject: [PATCH] Removal of all punctuations from filename #875 --- src/helpers/Sanitize.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helpers/Sanitize.ts b/src/helpers/Sanitize.ts index 2454210f..088142b7 100644 --- a/src/helpers/Sanitize.ts +++ b/src/helpers/Sanitize.ts @@ -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)