:fix: 文件夹名称中有特许字符时,文件打开失败的问题
This commit is contained in:
parent
428c7d9652
commit
1136836d14
@ -1756,7 +1756,7 @@ export default {
|
||||
api.uploadFolder({
|
||||
isFolder: true,
|
||||
filename: this.newFolderName,
|
||||
currentDirectory: this.path,
|
||||
currentDirectory: encodeURIComponent(this.path),
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
}).then((res) => {
|
||||
@ -1967,7 +1967,7 @@ export default {
|
||||
keyword: key,
|
||||
sortableProp: this.sortable.prop,
|
||||
order: this.sortable.order,
|
||||
currentDirectory: this.$route.query.path,
|
||||
currentDirectory: encodeURIComponent(this.$route.query.path),
|
||||
pageIndex: this.pagination.pageIndex,
|
||||
pageSize: this.pagination.pageSize
|
||||
}).then(res => {
|
||||
@ -1983,7 +1983,7 @@ export default {
|
||||
api.searchFileAndOpenDir({
|
||||
userId: this.$store.state.user.userId,
|
||||
id: row.id,
|
||||
currentDirectory: this.$route.query.path,
|
||||
currentDirectory: encodeURIComponent(this.$route.query.path),
|
||||
pageIndex: this.pagination.pageIndex,
|
||||
pageSize: this.pagination.pageSize
|
||||
}).then(res => {
|
||||
@ -1998,7 +1998,7 @@ export default {
|
||||
api.searchFileAndOpenDir({
|
||||
userId: this.$store.state.user.userId,
|
||||
id: row.id,
|
||||
currentDirectory: this.$route.query.path,
|
||||
currentDirectory: encodeURIComponent(this.$route.query.path),
|
||||
pageIndex: this.pagination.pageIndex,
|
||||
pageSize: this.pagination.pageSize
|
||||
}).then(res => {
|
||||
@ -2011,7 +2011,7 @@ export default {
|
||||
api.fileList({
|
||||
userId: this.$store.state.user.userId,
|
||||
username: this.$store.state.user.name,
|
||||
currentDirectory: this.$route.query.path,
|
||||
currentDirectory: encodeURIComponent(this.$route.query.path),
|
||||
queryFileType: this.queryFileType,
|
||||
sortableProp: this.sortable.prop,
|
||||
order: this.sortable.order,
|
||||
@ -2028,7 +2028,7 @@ export default {
|
||||
this.beforeLoadData(onLoad)
|
||||
api.fileList({
|
||||
userId: this.$store.state.user.userId,
|
||||
currentDirectory: this.path,
|
||||
currentDirectory: encodeURIComponent(this.$route.query.path),
|
||||
pageIndex: this.pagination.pageIndex,
|
||||
pageSize: this.pagination.pageSize
|
||||
}).then(res => {
|
||||
@ -2777,7 +2777,7 @@ export default {
|
||||
api.newFolder({
|
||||
isFolder: true,
|
||||
filename: data.name,
|
||||
currentDirectory: path,
|
||||
currentDirectory: encodeURIComponent(this.$route.query.path),
|
||||
username: this.$store.state.user.name,
|
||||
userId: this.$store.state.user.userId
|
||||
}).then((res) => {
|
||||
|
||||
@ -10,9 +10,14 @@ export default {
|
||||
// 预览文件的url
|
||||
previewUrl: function(username, file, token) {
|
||||
if (token) {
|
||||
return `${this.baseUrl}/file/${username}${file.path}${encodeURIComponent(file.name)}?jmal-token=${token}`
|
||||
let path = "/"
|
||||
if (file.path.length > 1) {
|
||||
path = encodeURIComponent(file.path.substr(1, file.path.length - 2))
|
||||
}
|
||||
const filename = encodeURIComponent(file.name);
|
||||
return `${this.baseUrl}/file/${username}/${path}/${filename}?jmal-token=${token}`
|
||||
} else {
|
||||
return `${this.baseUrl}/file/${username}${file.path}${encodeURIComponent(file.name)}`
|
||||
return `${this.baseUrl}/file/${username}/${path}/${filename}`
|
||||
}
|
||||
},
|
||||
// mardown里上传图片后的图片预览地址
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user