diff --git a/src/components/FancyTree/index.vue b/src/components/FancyTree/index.vue index 626c70f..7823798 100644 --- a/src/components/FancyTree/index.vue +++ b/src/components/FancyTree/index.vue @@ -243,7 +243,7 @@ }).then(() => { api.delFile({ username: this.$store.state.user.name, - path: data.path + path: encodeURI(data.path) }).then(()=>{ this.$emit('removeFile', data.path) let node = this.tree.getActiveNode() @@ -261,7 +261,7 @@ let path = this.currentPath.substring(0,this.currentPath.length-title.length) api.upperLevelList({ username: this.$store.state.user.name, - path: path, + path: encodeURI(path), }).then(res => { this.tree.reload(this.convert(res.data)) }) @@ -271,7 +271,7 @@ api.listfiles({ userId: this.$store.state.user.userId, username: this.$store.state.user.name, - path: this.currentPath, + path: encodeURI(this.currentPath), }).then(res => { this.tree.reload(this.convert(res.data)) }) @@ -292,7 +292,7 @@ api.listfiles({ userId: this.$store.state.user.userId, username: this.$store.state.user.name, - path: node.path, + path: encodeURI(node.path), }).then(res => { loading.close() if(res.data.length === 0){ @@ -311,7 +311,7 @@ api.listfiles({ userId: this.$store.state.user.userId, username: this.$store.state.user.name, - path: treeData.path, + path: encodeURI(treeData.path), }).then(res => { let oldname = treeData.name let data = res.data.map(doc => { @@ -350,10 +350,10 @@ } } api.addFile({ - fileName: fileName, + fileName: encodeURI(fileName), isFolder: node.folder, username: this.$store.state.user.name, - parentPath: parentPath + parentPath: encodeURI(parentPath) }).then((res)=>{ let str = node.folder?'文件夹':'文件' this.$message.success(`新建${str}成功`) @@ -429,7 +429,7 @@ api.renameByPath({ newFileName: newFileName, username: this.$store.state.user.name, - path: node.data.path + path: encodeURI(node.data.path) }).then(res => { if (res.data) { row.oldName = node.data.name @@ -491,7 +491,7 @@ return new Promise(function(resolve) { api.listfiles({ username: that.$store.state.user.name, - path: data.path, + path: encodeURI(data.path), }).then(res => { resolve(that.convert(res.data)) }) diff --git a/src/components/FileTree/DirTree.vue b/src/components/FileTree/DirTree.vue index 8a3dea6..3d43a86 100644 --- a/src/components/FileTree/DirTree.vue +++ b/src/components/FileTree/DirTree.vue @@ -174,8 +174,8 @@ export default { } api.newFolder({ isFolder: true, - filename: data.name, - currentDirectory: path, + filename: encodeURI(data.name), + currentDirectory: encodeURI(path), username: this.$store.state.user.name, userId: this.$store.state.user.userId }).then((res) => { diff --git a/src/components/FileTree/index.vue b/src/components/FileTree/index.vue index 2b08d76..c214212 100644 --- a/src/components/FileTree/index.vue +++ b/src/components/FileTree/index.vue @@ -76,7 +76,7 @@ if (node.level > 0){ api.listfiles({ username: this.$store.state.user.name, - path: node.data.path, + path: encodeURI(node.data.path), tempDir: this.tempDir }).then(res => { const nextNodes = res.data.map(data => { @@ -135,8 +135,8 @@ } api.newFolder({ isFolder: true, - filename: data.name, - currentDirectory: path, + filename: encodeURI(data.name), + currentDirectory: encodeURI(path), username: this.$store.state.user.name, userId: this.$store.state.user.userId }).then((res) => { diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 980e1b1..1a1fd0a 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -1662,7 +1662,7 @@ export default { // 浏览器的返回事件 goBack() { if (this.pathList.length <= 1) { - this.$router.push(`/?vmode=${this.vmode}&path=${encodeURIComponent(this.path)}`) + this.$router.push(`/?vmode=${this.vmode}&path=${encodeURI(this.path)}`) return } this.lastLink() @@ -1690,9 +1690,9 @@ export default { }) if (!unPushLink) { if (!this.$route.query.path) { - this.$router.push(`?vmode=${this.vmode}&path=${encodeURIComponent(this.path)}`) + this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}`) } else { - this.$router.push(`?vmode=${this.vmode}&path=${encodeURIComponent(this.path)}`) + this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}`) } } if (!unRefresh) { @@ -1755,8 +1755,8 @@ export default { this.newFolderLoading = true api.uploadFolder({ isFolder: true, - filename: this.newFolderName, - currentDirectory: encodeURIComponent(this.path), + filename: encodeURI(this.newFolderName), + currentDirectory: encodeURI(this.path), username: this.$store.state.user.name, userId: this.$store.state.user.userId }).then((res) => { @@ -1810,10 +1810,10 @@ export default { } } api.addFile({ - fileName: newFileName, + fileName: encodeURI(newFileName), isFolder: false, username: this.$store.state.user.name, - parentPath: parentPath + parentPath: encodeURI(parentPath) }).then((res) => { this.createTextFileLoading = false @@ -1967,7 +1967,7 @@ export default { keyword: key, sortableProp: this.sortable.prop, order: this.sortable.order, - currentDirectory: encodeURIComponent(this.$route.query.path), + currentDirectory: encodeURI(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: encodeURIComponent(this.$route.query.path), + currentDirectory: encodeURI(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: encodeURIComponent(this.$route.query.path), + currentDirectory: encodeURI(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: encodeURIComponent(this.$route.query.path), + currentDirectory: encodeURI(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: encodeURIComponent(this.$route.query.path), + currentDirectory: encodeURI(this.$route.query.path), pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize }).then(res => { @@ -2776,8 +2776,8 @@ export default { } api.newFolder({ isFolder: true, - filename: data.name, - currentDirectory: encodeURIComponent(this.$route.query.path), + filename: encodeURI(data.name), + currentDirectory: encodeURI(this.$route.query.path), username: this.$store.state.user.name, userId: this.$store.state.user.userId }).then((res) => { @@ -3067,7 +3067,7 @@ export default { const item = {'folder': row.name} this.pathList.push(item) this.pagination.pageIndex = 1 - const path = encodeURIComponent(this.path); + const path = encodeURI(this.path); this.$router.push(`?vmode=${this.vmode}&path=${path}`) this.openDir(row) } diff --git a/src/components/SimpleUploader/globalUploader.vue b/src/components/SimpleUploader/globalUploader.vue index 2c66451..5dc44d4 100755 --- a/src/components/SimpleUploader/globalUploader.vue +++ b/src/components/SimpleUploader/globalUploader.vue @@ -275,9 +275,9 @@ // 上传文件夹 api.uploadFolder({ isFolder: true, - folderPath: folder.parent.path, - filename: folder.name, - currentDirectory: this.params.currentDirectory, + folderPath: encodeURI(folder.parent.path), + filename: encodeURI(folder.name), + currentDirectory: encodeURI(this.params.currentDirectory), username: this.params.username, userId: this.params.userId }).then(() => { @@ -347,10 +347,10 @@ // 文件状态设为“合并中” this.statusSet(file.id, 'merging') api.mergeSimpleUpload({ - filename: encodeURIComponent(file.name), - relativePath: encodeURIComponent(file.relativePath), + filename: encodeURI(file.name), + relativePath: encodeURI(file.relativePath), identifier: file.uniqueIdentifier, - currentDirectory: this.params.currentDirectory, + currentDirectory: encodeURI(this.params.currentDirectory), username: this.params.username, userId: this.params.userId, totalSize: file.size, diff --git a/src/components/preview/ImageViewer.vue b/src/components/preview/ImageViewer.vue index c263768..8314134 100644 --- a/src/components/preview/ImageViewer.vue +++ b/src/components/preview/ImageViewer.vue @@ -90,6 +90,7 @@ export default { let viewIndex = 0 this.imageFiles = this.fileList.filter(element => !element.isFolder && element.contentType.startsWith('image')) this.imageFiles.forEach((element) => { + console.log(element) this.images.push({ thumbnail: this.getImageUrlbyThumbnail(element.id), source: this.getImageUrl(element) diff --git a/src/components/preview/SimTextPreview.vue b/src/components/preview/SimTextPreview.vue index 61fead5..08f6aeb 100644 --- a/src/components/preview/SimTextPreview.vue +++ b/src/components/preview/SimTextPreview.vue @@ -290,7 +290,7 @@ shareId: this.shareId, fileId: file.id, id: file.id, - path: file.path, + path: encodeURI(file.path), username: this.$store.state.user.name }).then((res)=>{ this.loading.close() @@ -518,7 +518,7 @@ message: '  正在加载数据...' }) api.previewTextByPath({ - path: row.path, + path: encodeURI(row.path), username: this.$store.state.user.name }).then((res)=>{ this.loading.close() diff --git a/src/utils/file-config.js b/src/utils/file-config.js index 9f0391b..0662cde 100644 --- a/src/utils/file-config.js +++ b/src/utils/file-config.js @@ -12,9 +12,9 @@ export default { if (token) { let path = "/" if (file.path.length > 1) { - path = encodeURIComponent(file.path.substr(1, file.path.length - 2)) + path = encodeURI(file.path.substr(1, file.path.length - 2)) } - const filename = encodeURIComponent(file.name); + const filename = encodeURI(file.name); return `${this.baseUrl}/file/${username}/${path}/${filename}?jmal-token=${token}` } else { return `${this.baseUrl}/file/${username}/${path}/${filename}` @@ -32,8 +32,7 @@ export default { // 下载文件 download: function(username, file, token) { fileApi.isAllowDownload().then(() => { - encodeURI() - let url = `${this.baseUrl}/file/${username}${file.path}${encodeURIComponent(file.name)}?jmal-token=${token}&o=download` + let url = `${this.baseUrl}/file/${username}${encodeURI(file.path)}${encodeURI(file.name)}?jmal-token=${token}&o=download` window.open(url, '_self') }) }, diff --git a/src/views/home/mobile/index.vue b/src/views/home/mobile/index.vue index a1e801d..56ea8b4 100644 --- a/src/views/home/mobile/index.vue +++ b/src/views/home/mobile/index.vue @@ -743,7 +743,7 @@ export default { // 浏览器的返回事件 goBack() { if (this.pathList.length <= 1) { - this.$router.push(`/_m?vmode=${this.vmode}&path=${encodeURIComponent(this.path)}`) + this.$router.push(`/_m?vmode=${this.vmode}&path=${encodeURI(this.path)}`) return } this.clickBack() @@ -849,9 +849,9 @@ export default { }) if (!unPushLink) { if (!this.$route.query.path) { - this.$router.push(`/_m?vmode=${this.vmode}&path=${encodeURIComponent(this.path)}`) + this.$router.push(`/_m?vmode=${this.vmode}&path=${encodeURI(this.path)}`) } else { - this.$router.push(`/_m?vmode=${this.vmode}&path=${encodeURIComponent(this.path)}`) + this.$router.push(`/_m?vmode=${this.vmode}&path=${encodeURI(this.path)}`) } } if (!unRefresh) { @@ -881,7 +881,7 @@ export default { this.beforeLoadData(onLoad) api.fileList({ userId: this.$store.state.user.userId, - currentDirectory: this.$route.query.path, + currentDirectory: encodeURI(this.$route.query.path), queryFileType: this.queryFileType, sortableProp: this.sortableProp, order: this.order, @@ -903,7 +903,7 @@ export default { userId: this.$store.state.user.userId, username: this.$store.state.user.name, keyword: key, - currentDirectory: this.$route.query.path, + currentDirectory: encodeURI(this.$route.query.path), pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize }).then(res => { @@ -1064,7 +1064,7 @@ export default { item['folder'] = row.name item['index'] = this.pathList.length - 1 this.pathList.push(item) - this.$router.push(`/_m?vmode=${this.vmode}&path=${encodeURIComponent(this.path)}`) + this.$router.push(`/_m?vmode=${this.vmode}&path=${encodeURI(this.path)}`) this.getFileList() } else { if (row.contentType.startsWith('image')) { @@ -1184,7 +1184,7 @@ export default { // 打开文件选择框 Bus.$emit('openUploader', { // 传入的参数 - currentDirectory: this.path, + currentDirectory: encodeURI(this.path), username: this.$store.state.user.name, userId: this.$store.state.user.userId }) @@ -1194,7 +1194,7 @@ export default { // 打开文件夹选择框 Bus.$emit('uploadFolder', { // 传入的参数 - currentDirectory: this.path, + currentDirectory: encodeURI(this.path), username: this.$store.state.user.name, userId: this.$store.state.user.userId }) @@ -1206,8 +1206,8 @@ export default { if (this.newFolderName) { api.uploadFolder({ isFolder: true, - filename: this.newFolderName, - currentDirectory: this.path, + filename: encodeURI(this.newFolderName), + currentDirectory: encodeURI(this.path), username: this.$store.state.user.name, userId: this.$store.state.user.userId }).then((res) => { diff --git a/src/views/markdown/index.vue b/src/views/markdown/index.vue index 5fe1ec8..dbccd7b 100644 --- a/src/views/markdown/index.vue +++ b/src/views/markdown/index.vue @@ -468,7 +468,7 @@ export default { fileId: this.$route.query.id, userId: this.$store.state.user.userId, username: this.$store.state.user.name, - filename: filename, + filename: encodeURI(filename), cover: this.file.cover, isDraft: this.draft, isRelease: this.file.release, @@ -476,7 +476,7 @@ export default { slug: this.file.slug ? this.file.slug : this.filename, categoryIds: this.file.categoryIds, tagNames: this.dynamicTags, - currentDirectory: this.storageLocation, + currentDirectory: encodeURI(this.path), contentText: this.contentEditor.getValue(), html: this.contentEditor.getHTML(), uploadDate: this.file.uploadDate,