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