You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(router-core): preserve percent-encoded URL-unsafe chars in decodeSegment
Replace decodeURI()-based decoding with per-character decoding that
preserves the WHATWG URL path percent-encode set ({, }, <, >, ", `)
and ASCII control characters (0x00-0x1F, 0x7F) in their encoded form.
Previously, decodeSegment decoded these characters and sanitizePathSegment
stripped the control chars. This created mismatches between the original
request URL and the router's internal representation, causing infinite
307 redirect loops on paths like /%7B%7Btemplate%7D%7D.
By keeping these characters encoded, the router's path representation
matches what browsers and upstream layers send, eliminating the mismatch
that triggered spurious redirects.
Fixes#7587.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fix(router-core): preserve percent-encoded URL-unsafe characters in `decodeSegment` to prevent infinite redirect loops
6
+
7
+
`decodeSegment` now uses per-character decoding instead of `decodeURI`, preserving characters in the WHATWG URL "path percent-encode set" (`<`, `>`, `"`, `` ` ``, `{`, `}`) and ASCII control characters in their percent-encoded form. This prevents mismatches between the original URL and the router's internal representation that previously caused infinite 307 redirect loops on paths containing these characters (e.g. `/%7B%7Btemplate%7D%7D`).
0 commit comments