Skip to content

fix(yew-router): use path instead of basename in strip_basename fallback#4030

Merged
Madoshakalaka merged 1 commit intomasterfrom
fix/strip-basename-path-corruption
Mar 2, 2026
Merged

fix(yew-router): use path instead of basename in strip_basename fallback#4030
Madoshakalaka merged 1 commit intomasterfrom
fix/strip-basename-path-corruption

Conversation

@Madoshakalaka
Copy link
Copy Markdown
Member

Fixes #4028

It affects users who set a basename via the `basename` prop on
`<BrowserRouter>`/`<HashRouter>`, or implicitly via a `<base href>`
element. When the browser URL exactly equals the basename without a
trailing slash (e.g. `/base` instead of `/base/`), strip_basename
produced `//base` instead of `/`, which round-tripped through
prefix_basename to corrupt the URL to `/base//base` and cause a 404.

This is triggered by direct URL access, external links, bookmarks,
and server redirects to the bare basename path. Internal navigation
via `<Link>`, `navigator.push()`, etc. was unaffected.
@Madoshakalaka Madoshakalaka merged commit a9b3978 into master Mar 2, 2026
21 checks passed
@Madoshakalaka Madoshakalaka added A-yew-router Area: The yew-router crate bug and removed bug labels Mar 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2026

Visit the preview URL for this PR (updated for commit 3527297):

https://yew-rs-api--pr4030-fix-strip-basename-p-g96shxpl.web.app

(expires Mon, 09 Mar 2026 06:14:23 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2026

Size Comparison

Details
examples master (KB) pull request (KB) diff (KB) diff (%)
async_clock 100.188 100.188 0 0.000%
boids 168.073 168.073 0 0.000%
communication_child_to_parent 93.464 93.464 0 0.000%
communication_grandchild_with_grandparent 105.240 105.240 0 0.000%
communication_grandparent_to_grandchild 101.603 101.603 0 0.000%
communication_parent_to_child 90.892 90.892 0 0.000%
contexts 105.142 105.142 0 0.000%
counter 86.274 86.274 0 0.000%
counter_functional 88.269 88.269 0 0.000%
dyn_create_destroy_apps 90.312 90.312 0 0.000%
file_upload 99.335 99.335 0 0.000%
function_delayed_input 94.362 94.362 0 0.000%
function_memory_game 172.937 172.937 0 0.000%
function_router 406.669 406.649 -0.020 -0.005%
function_todomvc 164.156 164.156 0 0.000%
futures 235.151 235.151 0 0.000%
game_of_life 104.709 104.709 0 0.000%
immutable 255.739 255.739 0 0.000%
inner_html 80.795 80.795 0 0.000%
js_callback 109.369 109.369 0 0.000%
keyed_list 179.717 179.717 0 0.000%
mount_point 84.139 84.139 0 0.000%
nested_list 113.048 113.048 0 0.000%
node_refs 91.518 91.518 0 0.000%
password_strength 1729.144 1729.144 0 0.000%
portals 93.027 93.027 0 0.000%
router 377.218 377.198 -0.020 -0.005%
suspense 113.450 113.450 0 0.000%
timer 88.625 88.625 0 0.000%
timer_functional 98.867 98.867 0 0.000%
todomvc 142.080 142.080 0 0.000%
two_apps 86.139 86.139 0 0.000%
web_worker_fib 136.215 136.215 0 0.000%
web_worker_prime 187.452 187.452 0 0.000%
webgl 83.217 83.217 0 0.000%

✅ None of the examples has changed their size significantly.

@Madoshakalaka Madoshakalaka deleted the fix/strip-basename-path-corruption branch March 2, 2026 06:19
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2026

Benchmark - SSR

Yew Master

Details
Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 310.786 311.304 310.972 0.161
Hello World 10 483.359 502.446 489.998 6.843
Function Router 10 31450.184 32301.704 31835.892 230.535
Concurrent Task 10 1005.966 1007.818 1007.069 0.711
Many Providers 10 1097.733 1154.617 1124.053 14.646

Pull Request

Details
Benchmark Round Min (ms) Max (ms) Mean (ms) Standard Deviation
Baseline 10 310.679 311.262 310.916 0.183
Hello World 10 506.473 524.372 513.132 6.656
Function Router 10 31412.132 31790.692 31617.412 106.933
Concurrent Task 10 1006.170 1007.830 1007.229 0.453
Many Providers 10 1151.480 1166.733 1157.893 5.011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-yew-router Area: The yew-router crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

yew-router discards path if it doesn't start with /

1 participant