This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 0615306  use the raw path query string to avoid double-decoding.
0615306 is described below

commit 0615306c26f83ae073ba3ca0875af97eb0114972
Author: Daniel Gruno <[email protected]>
AuthorDate: Mon Nov 29 18:49:51 2021 +0100

    use the raw path query string to avoid double-decoding.
---
 server/plugins/formdata.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/server/plugins/formdata.py b/server/plugins/formdata.py
index 94c0f90..d22e0f2 100644
--- a/server/plugins/formdata.py
+++ b/server/plugins/formdata.py
@@ -31,9 +31,12 @@ ERRONEOUS_PAYLOAD = "Erroneous payload received"
 
 async def parse_formdata(body_type, request: aiohttp.web.BaseRequest) -> dict:
     indata = {}
-    # Some args have no values, e.g. quick, emailsOnly
-    for key, val in urllib.parse.parse_qsl(request.query_string, 
keep_blank_values = True):
-        indata[key] = val
+    # Do we have query string arguments?
+    if "?" in request.path_qs:
+        query_string = request.path_qs.split("?", 1)[1]
+        # Some args have no values, e.g. quick, emailsOnly
+        for key, val in urllib.parse.parse_qsl(query_string, 
keep_blank_values=True):
+            indata[key] = val
     # PUT/POST form data?
     if request.method in ["PUT", "POST"]:
         if request.can_read_body:

Reply via email to