From f73b7defb04d1f9c322a76391ce7ac1d14ce138a Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 5 Aug 2025 21:12:30 +0800 Subject: [PATCH] perf: The use of .replaceAll('#', '%23') is now redundant. encodeURIComponent used on the previous line already handles encoding the # character. This line can be removed. --- src/components/ShowFile/ShowFile.vue | 4 ++-- src/utils/file-config.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 6793a70..bd6f5d0 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2431,7 +2431,7 @@ export default { keywordQuery = '' searchOpenFolder = '' } - this.$router.push(`?vmode=${this.vmode}&path=${encodeURIComponent(this.path).replaceAll('#', '%23')}${queryFolder ? '&folder=' + queryFolder : ''}${queryTagId}${basePath}${keywordQuery}${searchOpenFolder}`) + this.$router.push(`?vmode=${this.vmode}&path=${encodeURIComponent(this.path)}${queryFolder ? '&folder=' + queryFolder : ''}${queryTagId}${basePath}${keywordQuery}${searchOpenFolder}`) } if (!unRefresh) { this.pagination.pageIndex = 1 @@ -4423,7 +4423,7 @@ export default { this.path = this.path.replace(/\/\//g, '/') // 去掉this.path开头的this.basePath this.path = this.path.replace(this.basePath, '/') - const path = encodeURIComponent(this.path).replaceAll('#', '%23') + const path = encodeURIComponent(this.path) const item = { folder: row.name, shareBase: row.shareBase } this.pathList.push(item) this.pagination.pageIndex = 1 diff --git a/src/utils/file-config.js b/src/utils/file-config.js index 3853745..db5db56 100644 --- a/src/utils/file-config.js +++ b/src/utils/file-config.js @@ -37,7 +37,6 @@ 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('#', '%23') fileUrl = fileUrl.replaceAll(/%5C/g, '/') if (file.userId !== store.getters.userId && token && !shareToken) {