From a6713bae9575d38ab21970db0938dbd5a58a8a5c Mon Sep 17 00:00:00 2001 From: jmal Date: Sun, 17 Aug 2025 12:08:59 +0800 Subject: [PATCH] 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}`