-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Link to and useParam decode %25 only #7987
Comments
After thinking about it some more, I think remix-run/history#505 might apply here so then this wouldn't be an issue (for link to at least) however because of this issue: #7173 (comment) |
I've got the same issue. I want the url of an item to be (an encoded version of) its name, so I've got <Link to={`/item/${encodeURIComponent(item.name)}`>{item.name}</Link> And I'm trying to retrieve the item name on the item page. I've got <Router>
<Switch>
<Route path='/item/:itemName'>
<ViewItem />
</Route
</Switch
</Router> And in the const { itemName } = useParams(); But if the item name is How can I link to an arbitrary item name, and retrieve the correct name from the URL on the view item page? |
This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed. |
This issue has been automatically closed because we haven't received a response from the original author 🙈. This automation helps keep the issue tracker clean from issues that aren't actionable. Please reach out if you have more information for us! 🙂 |
We are experiencing a similar issue where a parameter is automatically converting "%25" into "%". Here is the use case:
However, when receiving the "useParams", it automatically converts "%25" to "%". As a result, the received parameter is already decoded, and when we decode it again, it changes to "%3A". This causes a failure in our API logic. It appears that this issue was closed without any resolution. We kindly request your assistance in addressing this matter. |
What version of React Router are you using?
5.2.1
Steps to Reproduce
Here is the sandbox
You can click the links provided and see the url is decoded for %25 but not %24.
Also if you type the url path of %25 the value of the param is just "%" but is "%24" for %24
Expected Behavior
I expected %25 not to be decoded like all other encoded special characters
Actual Behavior
%25 is the only special character code that is decoded while other special character codes are not decoded.
The text was updated successfully, but these errors were encountered: