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.

This commit is contained in:
jmal 2025-08-05 21:12:30 +08:00
parent 00c0d99225
commit f73b7defb0
2 changed files with 2 additions and 3 deletions

View File

@ -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

View File

@ -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) {