From 627fff797198d2d3ad3d1207b03a89dd810c4d3d Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 3 Jan 2021 15:43:12 +0100 Subject: [PATCH] webconfig: Comment utf-8 assumption --- share/tools/web_config/webconfig.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index c8c3c7807..01c7b7aaf 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -1326,6 +1326,12 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): postvars = parse_qs(url_str, keep_blank_values=1) elif ctype == "application/json": length = int(self.headers["content-length"]) + # This used to use the provided encoding, but we use utf-8 + # all around the place and nobody has ever complained. + # + # If any other encoding is received this will raise a UnicodeError, + # which will throw us out of the function and should at most exit webconfig. + # If that happens to anyone we expect bug reports. url_str = self.rfile.read(length).decode("utf-8") postvars = json.loads(url_str) elif ctype == "multipart/form-data":