From ed1bd0f1f526c7abe57e85d2e2370fc64555eeaa Mon Sep 17 00:00:00 2001 From: jmal Date: Sun, 17 Aug 2025 12:05:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=B0=86=E6=96=87=E4=BB=B6URL?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E7=BC=96=E7=A0=81=E6=96=9C=E6=9D=A0=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E4=B8=BA=E7=A1=AE=E4=BF=9D=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/file-config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/file-config.js b/src/utils/file-config.js index db5db56..9a1d59d 100644 --- a/src/utils/file-config.js +++ b/src/utils/file-config.js @@ -38,6 +38,7 @@ export default { let baseUrl = serverUrl || this.baseUrl let fileUrl = `${baseUrl}/file/${store.getters.name}${encodeURIComponent(file.path)}${encodeURIComponent(file.name)}` fileUrl = fileUrl.replaceAll(/%5C/g, '/') + fileUrl = fileUrl.replaceAll(/%2F/g, '/') if (file.userId !== store.getters.userId && token && !shareToken) { return `${baseUrl}/pre-file/${file.id}/${encodeURIComponent(file.name)}?jmal-token=${token}&name=${username}` From a6713bae9575d38ab21970db0938dbd5a58a8a5c Mon Sep 17 00:00:00 2001 From: jmal Date: Sun, 17 Aug 2025 12:08:59 +0800 Subject: [PATCH 2/2] fix: optimize file URL encoding by consolidating replacement logic for backslashes and slashes --- src/utils/file-config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/file-config.js b/src/utils/file-config.js index 9a1d59d..6e3fd0a 100644 --- a/src/utils/file-config.js +++ b/src/utils/file-config.js @@ -37,8 +37,7 @@ export default { previewUrl: function(username, file, token, shareToken, serverUrl) { let baseUrl = serverUrl || this.baseUrl let fileUrl = `${baseUrl}/file/${store.getters.name}${encodeURIComponent(file.path)}${encodeURIComponent(file.name)}` - fileUrl = fileUrl.replaceAll(/%5C/g, '/') - fileUrl = fileUrl.replaceAll(/%2F/g, '/') + fileUrl = fileUrl.replaceAll(/%5C|%2F/g, '/') if (file.userId !== store.getters.userId && token && !shareToken) { return `${baseUrl}/pre-file/${file.id}/${encodeURIComponent(file.name)}?jmal-token=${token}&name=${username}`