From f53cd00cc181c14606b6ffa29f9334d39767e419 Mon Sep 17 00:00:00 2001 From: Franklyn Date: Sun, 6 Sep 2020 20:36:24 +0100 Subject: [PATCH] Use encodeURI for paths Moonraker expects file paths to use un-escaped file paths, such as gcodes/some%20file.gcode, but encodeURIComponent will always escape the slash. Using encodeURI here will not. --- src/pages/Files.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Files.vue b/src/pages/Files.vue index 0e8d294b..9f1b3bea 100644 --- a/src/pages/Files.vue +++ b/src/pages/Files.vue @@ -403,7 +403,7 @@ let filename = (this.currentPath+"/"+this.contextMenu.item.filename); let link = document.createElement("a"); link.download = name; - link.href = 'http://' + this.hostname + ':' + this.port + '/server/files/' + encodeURIComponent(filename); + link.href = 'http://' + this.hostname + ':' + this.port + '/server/files/' + encodeURI(filename); document.body.appendChild(link); link.click(); document.body.removeChild(link); @@ -435,7 +435,7 @@ removeFile() { let filename = (this.currentPath+"/"+this.contextMenu.item.filename); axios.delete( - 'http://'+ this.hostname + ':' + this.port +'/server/files/'+encodeURIComponent(filename) + 'http://'+ this.hostname + ':' + this.port +'/server/files/' + encodeURI(filename) ).then((result) => { this.$toast.success(result.data.result+" successfully deleted."); }).catch(() => {