fix(router-core): preserve encoded slashes in splat params - #7893
fix(router-core): preserve encoded slashes in splat params#7893xianjianlf2 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughSplat parameter decoding preserves encoded slashes within segments while decoding other characters. Wildcard and fuzzy catch-all extraction use the new behavior, with tests covering both matching modes. ChangesSplat parameter decoding
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Added a short docstring for the splat decoding helper to clarify why decoding happens segment-by-segment and why encoded slashes stay escaped. Local check:
|
Fixes #7871.
Splat params span multiple path segments, so decoding the whole splat with
decodeURIComponentmakes an encoded slash inside a segment indistinguishable from a real path separator.This decodes splat params segment-by-segment and keeps
%2Fencoded inside each segment. Other encoded characters in the segment, like%20,%23, and%3D, are still decoded as before. The same helper is used for fuzzy**params.Tests:
pnpm --dir packages/router-core test:unit --run tests/path.test.tspnpm --dir packages/router-core test:eslintpnpm --dir packages/history build && pnpm --dir packages/router-core test:types:ts70Summary by CodeRabbit
*) and fuzzy catch-all (**) route parameter decoding so encoded slashes (%2F) stay within the same matched segment./).