-
-
Notifications
You must be signed in to change notification settings - Fork 716
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
feat(react-router): allow unencoded characters in dynamic path segments #2677
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit e21f904. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
75f7c26
to
508b397
Compare
should we maybe expose this as a config option to the user? some might want different characters, some might want no characters etc? |
That's a good idea! @alma-lp would this be something you'd be able to implement? |
I should. I'll take a look. |
508b397
to
ff5392c
Compare
please add a test that configures router with some allowed chars, navigate to a route by setting a path param to contain one of the allowed chars and then check if the url is not encoded |
Interesting. this is a completely different approach, but seemingly much simpler, than adding prefix/suffix support, tho if I understand it correctly would actually be sufficient for my usecase as we use /@username routes as well. Just for reference, I added some thoughts here #707 (comment) |
@CanRau this does not allow prefixes. this just prevents path params containing e.g. "@" to be urlencoded. the path param will still be the full string |
Yea just realized that it wouldn't help with route matching 😔 which we need as we have those /@username paths at the root next to other dynamic and non-dynamic routes 😬 |
ff5392c
to
de7d88e
Compare
de7d88e
to
e21f904
Compare
This comment was marked as resolved.
This comment was marked as resolved.
It looks like this fix is incomplete. Links to routes such as |
@jmkd3v have you configured allowed characters on your router? const router = createRouter({
...
pathParamsAllowedCharacters: ['@']
}) |
oh, I didn't know I had to configure it! that fixed it, thank you so much @CanRau! |
Currently any path params with a "@" character are URI encoded. Modern browsers handle this fine and it is a common pattern (e.g. youtube.com/@exampleChannel) to have them unencoded in a path.