Skip to content

Commit 2122fd3

Browse files
author
yzcheung
committed
Fix query string parsing regression introduced in 2.18.2 #3106
1 parent dd74965 commit 2122fd3

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

dash/_pages.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
import re
66
import sys
77
from fnmatch import fnmatch
8-
from pathlib import Path
98
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
1111

1212
import flask
1313

1414
from . import _validate
15-
from ._utils import AttributeDict
16-
from ._get_paths import get_relative_path
1715
from ._callback_context import context_value
1816
from ._get_app import get_app
19-
17+
from ._get_paths import get_relative_path
18+
from ._utils import AttributeDict
2019

2120
CONFIG = AttributeDict()
2221
PAGE_REGISTRY = collections.OrderedDict()
@@ -114,17 +113,14 @@ def _infer_module_name(page_path):
114113

115114

116115
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("?"):
121117
return {}
122118

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()}
128124

129125

130126
def _parse_path_variables(pathname, path_template):

0 commit comments

Comments
 (0)