Open
Description
What version of React Router are you using?
6.8.0
Steps to Reproduce
I am using createBrowserRouter
to prohibit certain calls from happening, and when I do
const router = createBrowserRouter([
{
path: '*',
element
}
]);
const _navigate = router.navigate.bind(router);
router.navigate = (to, opts) => {
const allowed = true
if (!allowed) return null;
return _navigate(to, opts);
};
return <RouterProvider router={router} />;
To reproduce, pass an object to to like the following:
{ pathname: 'ABC/TEST%257FAB' }
the percentage in the pathname is encoded (%25) and it seems that the component being initialized ends up with incorrect props.params.
Expected Behavior
{
"params": {
"*": "ABC/TEST%257FAB",
"id": "ABC/TEST%257FAB"
},
"location": {
"pathname": "/ABC/TEST%257FAB",
"search": "",
"hash": "",
"state": null,
"key": "gqcl35xw"
}
}
Actual Behavior
{
"params": {
"*": "ABC/TEST�AB",
"id": "TEST�AB"
},
"location": {
"pathname": "/ABC/TEST%257FAB",
"search": "",
"hash": "",
"state": null,
"key": "gqcl35xw"
}
}