From 6d465a40fbba4b1f883bfb1859b4b9b206096e7d Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Mon, 21 Jul 2025 21:32:10 +0800 Subject: [PATCH] fix: don't use comma as separator when parsing filenames, closes #1622 (#1650) --- apps/readest-app/src/helpers/openWith.ts | 3 +-- apps/readest-app/src/utils/nav.ts | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/readest-app/src/helpers/openWith.ts b/apps/readest-app/src/helpers/openWith.ts index 8a83833f..c8319057 100644 --- a/apps/readest-app/src/helpers/openWith.ts +++ b/apps/readest-app/src/helpers/openWith.ts @@ -14,8 +14,7 @@ interface CliArgument { const parseWindowOpenWithFiles = () => { const params = new URLSearchParams(window.location.search); - const filesParams = params.get('files') || ''; - const files = filesParams ? filesParams.split(',').map(decodeURIComponent) : []; + const files = params.getAll('file'); return files.length > 0 ? files : window.OPEN_WITH_FILES; }; diff --git a/apps/readest-app/src/utils/nav.ts b/apps/readest-app/src/utils/nav.ts index 5029675a..a689df7d 100644 --- a/apps/readest-app/src/utils/nav.ts +++ b/apps/readest-app/src/utils/nav.ts @@ -39,8 +39,9 @@ export const showReaderWindow = (appService: AppService, bookIds: string[]) => { }; export const showLibraryWindow = (appService: AppService, filenames: string[]) => { - const files = filenames.map((file) => `${encodeURIComponent(file)}`).join(','); - const url = `/library?files=${files}`; + const params = new URLSearchParams(); + filenames.forEach((filename) => params.append('file', filename)); + const url = `/library?${params.toString()}`; createReaderWindow(appService, url); };