From 2122fd39f3026ceee007e2b2188d61f18f06ac16 Mon Sep 17 00:00:00 2001 From: yzcheung <> Date: Wed, 25 Jun 2025 10:42:35 +0800 Subject: [PATCH 1/2] Fix query string parsing regression introduced in 2.18.2 #3106 --- dash/_pages.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/dash/_pages.py b/dash/_pages.py index ce8f1d1064..45538546e8 100644 --- a/dash/_pages.py +++ b/dash/_pages.py @@ -5,18 +5,17 @@ import re import sys from fnmatch import fnmatch -from pathlib import Path from os.path import isfile, join -from urllib.parse import parse_qs, unquote +from pathlib import Path +from urllib.parse import parse_qs import flask from . import _validate -from ._utils import AttributeDict -from ._get_paths import get_relative_path from ._callback_context import context_value from ._get_app import get_app - +from ._get_paths import get_relative_path +from ._utils import AttributeDict CONFIG = AttributeDict() PAGE_REGISTRY = collections.OrderedDict() @@ -114,17 +113,14 @@ def _infer_module_name(page_path): def _parse_query_string(search): - search = unquote(search) - if search and len(search) > 0 and search[0] == "?": - search = search[1:] - else: + if not search or not search.startswith("?"): return {} - parsed_qs = {} - for (k, v) in parse_qs(search).items(): - v = v[0] if len(v) == 1 else v - parsed_qs[k] = v - return parsed_qs + query_string = search[1:] + + parsed_qs = parse_qs(query_string, keep_blank_values=True) + + return {k: v[0] if len(v) == 1 else v for k, v in parsed_qs.items()} def _parse_path_variables(pathname, path_template): From 7aed2b81a9d457c958f4c465b0f71e52c6d7f1d2 Mon Sep 17 00:00:00 2001 From: yzcheung <> Date: Wed, 25 Jun 2025 11:06:10 +0800 Subject: [PATCH 2/2] Added changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ed315f9e8..91838c18ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## [UNRELEASED] ## Fixed +- [#3341](https://github.com/plotly/dash/pull/3341) Fixed query string parsing regression introduced in 2.18.2 where values containing unencoded `&` characters were being truncated. [#3106](https://github.com/plotly/dash/issues/3106) - [#3279](https://github.com/plotly/dash/pull/3279) Fix an issue where persisted values were incorrectly pruned when updated via callback. Now, callback returned values are correctly stored in the persistence storage. Fix [#2678](https://github.com/plotly/dash/issues/2678) - [#3298](https://github.com/plotly/dash/pull/3298) Fix dev_only resources filtering. - [#3315](https://github.com/plotly/dash/pull/3315) Fix pages module is package check.