From 37be5ac900f6d15243683b504abd1574b395905c Mon Sep 17 00:00:00 2001 From: choich Date: Tue, 7 Jul 2020 11:38:38 +0900 Subject: [PATCH 1/2] Fix url decoding for query string --- zappa/wsgi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/zappa/wsgi.py b/zappa/wsgi.py index 7f6674776..4c07b99db 100644 --- a/zappa/wsgi.py +++ b/zappa/wsgi.py @@ -51,6 +51,7 @@ def create_wsgi_request(event_info, else: query = event_info.get('queryStringParameters', {}) query_string = urlencode(query) if query else '' + query_string = urls.url_unquote(query_string) if context_header_mappings: for key, value in context_header_mappings.items(): From 2150727c1c319907b7e688e5472c19ec15ffa95e Mon Sep 17 00:00:00 2001 From: choich Date: Tue, 7 Jul 2020 12:01:35 +0900 Subject: [PATCH 2/2] Add test --- tests/tests.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/tests.py b/tests/tests.py index 5cc6b882a..011d55924 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -557,6 +557,19 @@ def test_wsgi_path_info_unquoted(self): request = create_wsgi_request(event, trailing_slash=True) self.assertEqual("/path:1", request['PATH_INFO']) + def test_wsgi_query_string_unquoted(self): + event = { + "body": {}, + "headers": {}, + "pathParameters": {}, + "path": '/path/path1', + "httpMethod": "GET", + "queryStringParameters": {"a": "A,B", "b": "C#D"}, + "requestContext": {} + } + request = create_wsgi_request(event) + self.assertEqual(request['QUERY_STRING'], "a=A,B&b=C#D") + def test_wsgi_latin1(self): event = { "body": {},