From ec7145bb01b7b9f735accdd373d320b36a75e7fb Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Mon, 3 Nov 2025 18:17:24 +0800 Subject: [PATCH] fix(upload): sanitize filenames before uploading to cloud bucket (#2396) --- apps/readest-app/src/utils/misc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/readest-app/src/utils/misc.ts b/apps/readest-app/src/utils/misc.ts index df604fc4..c4de55d6 100644 --- a/apps/readest-app/src/utils/misc.ts +++ b/apps/readest-app/src/utils/misc.ts @@ -9,7 +9,7 @@ export const getContentMd5 = (content: unknown) => md5(JSON.stringify(content)); export const makeSafeFilename = (filename: string, replacement = '_') => { // Windows restricted characters + control characters and reserved names - const unsafeCharacters = /[<>:"\/\\|?*\x00-\x1F]/g; + const unsafeCharacters = /[<>:%"\/\\|?*\x00-\x1F]/g; const reservedFilenames = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i; // Unsafe to use filename including file extensions over 255 bytes on Android const maxFilenameBytes = 250;