bugfix: delete files with special chars (fix #149)
Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
1 parent
4ec5ab0f53
commit
d74e38d0ba
3 files changed
+13
-8
No files matched your search
+1
-8
@@ -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 = "";
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user