-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Which project does this relate to?
Router
Describe the bug
The latest update in the router-core package, notably this commit 30c49e1
Has introduced an issue whenever search parameters are decoded that contain a % symbol in them.
The minimal reproduction will error the webpage on load with
Uncaught URIError: URI malformed
at decodeURIComponent (<anonymous>)
at toValue (chunk-PN7QCDU3.js?v=1cb8d5e8:862:41)
at chunk-PN7QCDU3.js?v=1cb8d5e8:874:18
at Array.reduce (<anonymous>)
at decode (chunk-PN7QCDU3.js?v=1cb8d5e8:871:18)
at Object.parseSearch (chunk-PN7QCDU3.js?v=1cb8d5e8:893:19)
at parse (chunk-PN7QCDU3.js?v=1cb8d5e8:1598:43)
at RouterCore.parseLocation (chunk-PN7QCDU3.js?v=1cb8d5e8:1609:24)
at RouterCore.update (chunk-PN7QCDU3.js?v=1cb8d5e8:1465:36)
at new RouterCore (chunk-PN7QCDU3.js?v=1cb8d5e8:2805:10)
The issue is due to the use of new URLSearchParams which will parse from testString=%25ba => ['testString', '%ba'] and is then sent onto the toValue method which uses the RegEx to look for any non-decoded characters, and then runs the decodeURIComponent method on a non-valid URI
Your Example Website or App
http://localhost:5173/?testString=%25ba
Steps to Reproduce the Bug or Issue
npx create-tsrouter-app@latest my-app --template file-routernpm run dev- Open URL
- Page won't load
Expected behavior
Expect the page to load
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome/Safari/Firefox
- Version: 1.117.1
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels