Skip to content

Fix query string parsing regression introduced in 2.18.2 #3106 #3341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 10 additions & 14 deletions dash/_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down