🐛fix(*): 修复文件名有特殊字符时上传失败的问题

This commit is contained in:
jmal 2021-05-02 09:00:32 +08:00
parent 3515ae6b5f
commit 7f29ea6dd3
2 changed files with 5 additions and 5 deletions

View File

@ -347,8 +347,8 @@
// 文件状态设为“合并中”
this.statusSet(file.id, 'merging')
api.mergeSimpleUpload({
filename: file.name,
relativePath: file.relativePath,
filename: encodeURIComponent(file.name),
relativePath: encodeURIComponent(file.relativePath),
identifier: file.uniqueIdentifier,
currentDirectory: this.params.currentDirectory,
username: this.params.username,

View File

@ -10,9 +10,9 @@ export default {
// 预览文件的url
previewUrl: function(username, file, token) {
if (token) {
return `${this.baseUrl}/file/${username}${file.path}${file.name}?jmal-token=${token}`
return `${this.baseUrl}/file/${username}${file.path}${encodeURIComponent(file.name)}?jmal-token=${token}`
} else {
return `${this.baseUrl}/file/${username}${file.path}${file.name}`
return `${this.baseUrl}/file/${username}${file.path}${encodeURIComponent(file.name)}`
}
},
// mardown里上传图片后的图片预览地址
@ -27,7 +27,7 @@ export default {
// 下载文件
download: function(username, file, token) {
fileApi.isAllowDownload().then(() => {
let url = `${this.baseUrl}/file/${username}${file.path}${file.name}?jmal-token=${token}&o=download`
let url = `${this.baseUrl}/file/${username}${file.path}${encodeURIComponent(file.name)}?jmal-token=${token}&o=download`
window.open(url, '_self')
})
},