fix: 修复某些文件上传失败的问题
This commit is contained in:
parent
c837c43c32
commit
92792ff6ba
@ -119,6 +119,7 @@ import SparkMD5 from 'spark-md5'
|
|||||||
import api from '@/api/file-api'
|
import api from '@/api/file-api'
|
||||||
import {formatNetSpeed} from '@/utils/number'
|
import {formatNetSpeed} from '@/utils/number'
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
|
import {encodeIfNeeded} from "@/utils/path";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {},
|
components: {},
|
||||||
@ -334,10 +335,10 @@ export default {
|
|||||||
// 上传文件夹
|
// 上传文件夹
|
||||||
api.uploadFolder({
|
api.uploadFolder({
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
folderPath: encodeURI(folder.parent.path),
|
folderPath: encodeIfNeeded(folder.parent.path),
|
||||||
filename: encodeURI(folder.name),
|
filename: encodeIfNeeded(folder.name),
|
||||||
folder: this.$route.query.folder,
|
folder: this.$route.query.folder,
|
||||||
currentDirectory: encodeURI(this.params.currentDirectory),
|
currentDirectory: encodeIfNeeded(this.params.currentDirectory),
|
||||||
username: this.params.username,
|
username: this.params.username,
|
||||||
userId: this.params.userId
|
userId: this.params.userId
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|||||||
@ -26,3 +26,15 @@ export function removePath() {
|
|||||||
Cookies.remove(pathListKey)
|
Cookies.remove(pathListKey)
|
||||||
return Cookies.remove(pathKey)
|
return Cookies.remove(pathKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isEncoded(str) {
|
||||||
|
return /%[0-9A-Fa-f]{2}/.test(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function encodeIfNeeded(str) {
|
||||||
|
if (isEncoded(str)) {
|
||||||
|
return str;
|
||||||
|
} else {
|
||||||
|
return encodeURI(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user