|
5 | 5 | import re |
6 | 6 | import sys |
7 | 7 | from fnmatch import fnmatch |
8 | | -from pathlib import Path |
9 | 8 | from os.path import isfile, join |
10 | | -from urllib.parse import parse_qs, unquote |
| 9 | +from pathlib import Path |
| 10 | +from urllib.parse import parse_qs |
11 | 11 |
|
12 | 12 | import flask |
13 | 13 |
|
14 | 14 | from . import _validate |
15 | | -from ._utils import AttributeDict |
16 | | -from ._get_paths import get_relative_path |
17 | 15 | from ._callback_context import context_value |
18 | 16 | from ._get_app import get_app |
19 | | - |
| 17 | +from ._get_paths import get_relative_path |
| 18 | +from ._utils import AttributeDict |
20 | 19 |
|
21 | 20 | CONFIG = AttributeDict() |
22 | 21 | PAGE_REGISTRY = collections.OrderedDict() |
@@ -114,17 +113,14 @@ def _infer_module_name(page_path): |
114 | 113 |
|
115 | 114 |
|
116 | 115 | def _parse_query_string(search): |
117 | | - search = unquote(search) |
118 | | - if search and len(search) > 0 and search[0] == "?": |
119 | | - search = search[1:] |
120 | | - else: |
| 116 | + if not search or not search.startswith("?"): |
121 | 117 | return {} |
122 | 118 |
|
123 | | - parsed_qs = {} |
124 | | - for (k, v) in parse_qs(search).items(): |
125 | | - v = v[0] if len(v) == 1 else v |
126 | | - parsed_qs[k] = v |
127 | | - return parsed_qs |
| 119 | + query_string = search[1:] |
| 120 | + |
| 121 | + parsed_qs = parse_qs(query_string, keep_blank_values=True) |
| 122 | + |
| 123 | + return {k: v[0] if len(v) == 1 else v for k, v in parsed_qs.items()} |
128 | 124 |
|
129 | 125 |
|
130 | 126 | def _parse_path_variables(pathname, path_template): |
|
0 commit comments