-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix(router): Ensure url params are decoded consistently across expo-router #25589
Conversation
17c041d
to
a462fe8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a regression test for invalid URL-encoded paths/parameters, such as /start%end
-- it's useful to define and document the behavior of invalid URLs.
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
c69b612
to
12ed264
Compare
…outer (expo#25589) # Why `useGlobalSearchParams` and `useLocalSearchParams` treat URL search parameters differently. Fix expo#25570 Fix expo#25323 # How I'm not 100% happy with this solution, I thought we could do it more in the `getStateFromPath`/`getPathFromState` but I couldn't get it working. Instead we just decode them directly before saving to the global store, or when accessing from the navigation context. # Test Plan Unit tests cover multiple scenarios, ensuring the parameters are consistently decoded. # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). --------- Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
Noob here. Just updated to sdk50 from 49. If I pass a firebase image url through local params It becomes invalid due to the decoding removing %2f. Use case is searching a user and then passing the details to profile screen. error for image: There a way to revert or disable decoding? |
It sounds like the custom parameters might need to be URL-encoded when serializing them. For now you could probably work around the issue by double-encoding your URL. |
Thanks, works for now |
Why
useGlobalSearchParams
anduseLocalSearchParams
treat URL search parameters differently.Fix #25570
Fix #25323
How
I'm not 100% happy with this solution, I thought we could do it more in the
getStateFromPath
/getPathFromState
but I couldn't get it working. Instead we just decode them directly before saving to the global store, or when accessing from the navigation context.Test Plan
Unit tests cover multiple scenarios, ensuring the parameters are consistently decoded.
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).