From af18c59623ca949792c79e5b22a151bae5eb947f Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Mon, 24 Feb 2025 10:40:11 -0500 Subject: [PATCH] work around parse_qs behavior in python < 3.11 --- www/lib/kojiweb/util.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/lib/kojiweb/util.py b/www/lib/kojiweb/util.py index 7aa03665..bf099f5f 100644 --- a/www/lib/kojiweb/util.py +++ b/www/lib/kojiweb/util.py @@ -211,6 +211,12 @@ class FieldStorageCompat(Mapping): """Emulate the parts of cgi.FieldStorage that we need""" def __init__(self, environ): + qs = environ.get('QUERY_STRING', '') + if not qs: + # for python < 3.11, parse_qs will error on a blank string + self.data = {} + return + data = parse_qs(environ.get('QUERY_STRING', ''), strict_parsing=True, keep_blank_values=True) # replace singleton lists with single values