changeset 4632:2e47b32a389d

client: encode strings in url paths
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 11 Oct 2019 12:54:15 +0200
parents 15372dd971e9
children c6349030ae60
files client/src/components/Bottlenecks.vue client/src/components/stretches/Stretches.vue client/src/components/systemconfiguration/PDFTemplates.vue client/src/components/usermanagement/Usermanagement.vue client/src/store/bottlenecks.js
diffstat 5 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Bottlenecks.vue	Fri Oct 11 12:23:11 2019 +0200
+++ b/client/src/components/Bottlenecks.vue	Fri Oct 11 12:54:15 2019 +0200
@@ -173,8 +173,7 @@
         this.openBottleneckSurveys = null;
       } else {
         this.loading = bottleneck;
-
-        HTTP.get("/surveys/" + bottleneck.properties.name, {
+        HTTP.get("/surveys/" + encodeURIComponent(bottleneck.properties.name), {
           headers: {
             "X-Gemma-Auth": localStorage.getItem("token"),
             "Content-type": "text/xml; charset=UTF-8"
--- a/client/src/components/stretches/Stretches.vue	Fri Oct 11 12:23:11 2019 +0200
+++ b/client/src/components/stretches/Stretches.vue	Fri Oct 11 12:54:15 2019 +0200
@@ -143,7 +143,7 @@
   methods: {
     download(stretch) {
       const { name } = stretch.properties;
-      HTTP.get(`/data/stretch/shape/${name}`, {
+      HTTP.get(`/data/stretch/shape/${encodeURIComponent(name)}`, {
         responseType: "blob",
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token")
--- a/client/src/components/systemconfiguration/PDFTemplates.vue	Fri Oct 11 12:23:11 2019 +0200
+++ b/client/src/components/systemconfiguration/PDFTemplates.vue	Fri Oct 11 12:54:15 2019 +0200
@@ -134,12 +134,15 @@
         element.style.display = "none";
         element.setAttribute("download", template.name + ".json");
         document.body.appendChild(element);
-        HTTP.get(`/templates/${template.type}/${template.name}`, {
-          headers: {
-            "X-Gemma-Auth": localStorage.getItem("token"),
-            "Content-type": "text/xml; charset=UTF-8"
+        HTTP.get(
+          `/templates/${template.type}/${encodeURIComponent(template.name)}`,
+          {
+            headers: {
+              "X-Gemma-Auth": localStorage.getItem("token"),
+              "Content-type": "text/xml; charset=UTF-8"
+            }
           }
-        })
+        )
           .then(response => {
             templateData = response.data.template_data;
             element.setAttribute(
@@ -306,12 +309,17 @@
           label: this.$gettext("Delete"),
           icon: "trash",
           callback: () => {
-            HTTP.delete(`/templates/${template.type}/${template.name}`, {
-              headers: {
-                "X-Gemma-Auth": localStorage.getItem("token"),
-                "Content-type": "text/xml; charset=UTF-8"
+            HTTP.delete(
+              `/templates/${template.type}/${encodeURIComponent(
+                template.name
+              )}`,
+              {
+                headers: {
+                  "X-Gemma-Auth": localStorage.getItem("token"),
+                  "Content-type": "text/xml; charset=UTF-8"
+                }
               }
-            }).then(() => {
+            ).then(() => {
               let removeIndex = this.templates.findIndex(
                 t => t.name === template.name
               );
--- a/client/src/components/usermanagement/Usermanagement.vue	Fri Oct 11 12:23:11 2019 +0200
+++ b/client/src/components/usermanagement/Usermanagement.vue	Fri Oct 11 12:54:15 2019 +0200
@@ -198,7 +198,7 @@
   },
   methods: {
     sendTestMail(user) {
-      HTTP.get("/testmail/" + user, {
+      HTTP.get("/testmail/" + encodeURIComponent(user), {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),
           "Content-type": "text/xml; charset=UTF-8"
--- a/client/src/store/bottlenecks.js	Fri Oct 11 12:23:11 2019 +0200
+++ b/client/src/store/bottlenecks.js	Fri Oct 11 12:54:15 2019 +0200
@@ -110,7 +110,7 @@
         commit("setSelectedBottleneck", name);
         if (name) {
           commit("surveysLoading", true);
-          HTTP.get("/surveys/" + name, {
+          HTTP.get("/surveys/" + encodeURIComponent(name), {
             headers: {
               "X-Gemma-Auth": localStorage.getItem("token"),
               "Content-type": "text/xml; charset=UTF-8"