From 7332cfa4b2655269cc762aa0d2f5b8336661b005 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Mon, 14 Jan 2019 01:36:27 -0600 Subject: [PATCH] Fix encode and params --- resources/lib/webservice.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/lib/webservice.py b/resources/lib/webservice.py index 83224ad8..9e338e28 100644 --- a/resources/lib/webservice.py +++ b/resources/lib/webservice.py @@ -141,7 +141,12 @@ class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): ''' Get the params ''' try: - params = dict(urlparse.parse_qsl(self.path[1:])) + path = self.path[1:] + + if '?' in path: + path = path.split('?', 1)[1] + + params = dict(urlparse.parse_qsl(path)) except Exception: params = {} @@ -161,7 +166,7 @@ class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): self.send_header('Content-type', 'text/html') self.send_header('Content-Length', len(path)) self.end_headers() - self.wfile.write(path.encode('utf-8')) + self.wfile.write(path) except Exception as error: