Path template variables not correctly parsed with dot
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Bug description
Path template variables are not parsed/populated correctly when using a dot (.) as seperator between placeholders as in /dot/<foo>.<bar>/.
When using /dot/<foo>.<bar>/ as path template, a request to /dot/abc.def should result in a call to layout(foo='abc', bar='def').
Instead there is a call to layout(foo='abc.de', part=None). (Note the missing e at the end)
Using /dash/<foo>-<bar>/ as path template, the request url is handled as expected and variables are parsed/populated correctly.
Expected behavior
Variables should be parsed as expected and correctly independent of characters between seperators.
Minimal example
import dash
from dash import Dash, html, dcc
app = Dash(__name__, use_pages=True, pages_folder="")
dash.register_page(
"Dot",
layout=lambda foo=None, bar=None: html.H1([html.B(foo), html.I(bar)]),
path_template='/dot/<foo>.<bar>'
)
dash.register_page(
"Dash",
layout=lambda foo=None, bar=None: html.H1([html.B(foo), html.I(bar)]),
path_template='/dash/<foo>-<bar>'
)
app.layout = html.Div(
[
html.H1("App"),
html.Div([
html.Div(dcc.Link(f"{page['name']} - {page['path']}", href=page["path"]))
for page in dash.page_registry.values()
]),
html.Hr(),
dash.page_container,
]
)
if __name__ == "__main__":
app.run_server(debug=True)
Environment
dash 2.8.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal Dash example and compare the /dot/<foo>.<bar> route with the working /dash/<foo>-<bar> route. Trace how path_template variables are parsed and populated, then verify that a request to /dot/abc.def produces foo='abc' and bar='def' without regressing dash-separated placeholders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100