bugfix: delete files with special chars (fix #149)

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2020-12-30 22:31:15 +01:00
1 parent 4ec5ab0f53
commit d74e38d0ba
3 files changed
+13 -8

No files matched your search

+1 -8
View File
@@ -533,14 +533,7 @@
}, 'files/getMove');
},
removeFile() {
let filename = (this.currentPath+"/"+this.contextMenu.item.filename);
axios.delete(
'//'+ this.hostname + ':' + this.port +'/server/files/' + encodeURI(filename)
).then((result) => {
this.$toast.success(result.data.result+" successfully deleted.");
}).catch(() => {
this.$toast.error("Error! Cannot delete file.");
});
this.$socket.sendObj('server.files.delete_file', { path: this.currentPath+"/"+this.contextMenu.item.filename }, 'files/getDeleteFile');
},
createDirectory: function() {
this.dialogCreateDirectory.name = "";
+1
View File
@@ -84,6 +84,7 @@ export default class WebSocketClient {
} else {
let result = data.result
if (result === "ok") result = { result: result }
if (typeof(result) === "string") result = { result: result }
let preload = {}
let wsData = this.wsData.filter(item => item.id === data.id)[0]
+11
View File
@@ -60,4 +60,15 @@ export default {
commit('void', null, { root: true });
}
},
getDeleteFile({ commit }, payload) {
if (payload.error) {
Vue.$toast.error(payload.error.message);
} else if ('result' in payload) {
let delPath = payload.result.substr(payload.result.lastIndexOf("/")+1);
Vue.$toast.success("Successfully deleted "+delPath);
commit('void', null, { root: true });
}
},
}