-
-
Notifications
You must be signed in to change notification settings - Fork 252
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: Handle external URLs passed to redirect
and permanentRedirect
#1084
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@mhogeveen is attempting to deploy a commit to the next-intl Team on Vercel. A member of the Team first needs to authorize it. |
That sounds reasonable, thanks for the proposal! Just some minor remarks:
Thanks a lot! |
I've just updated the PR to use the same external link detection used in the
next-intl/packages/next-intl/src/shared/utils.tsx Lines 33 to 53 in 312956e
If I'm missing something let me know! |
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.
Fantastic PR, thanks a lot @mhogeveen! 🙌
I've added another commit with minor cleanup stuff, hope you don't mind.
Thanks also for checking useRouter
! You're right, all the necessary handling was already in place there, only the redirect functions were missing.
redirect
and permanentRedirect
Thanks for the quick response @amannn. It's much appreciated! |
This PR addresses an issue where absolute URL's used as pathnames in the
redirect
andpermanentRedirect
functions returned fromcreateSharedPathnamesNavigation
are localized.Current behaviour:
Expected behaviour:
Proposed solution:
Include a check whether to localize the given pathname based on the path starting with a
/
in:packages/next-intl/src/navigation/shared/baseRedirect.tsx
packages/next-intl/src/navigation/shared/basePermanentRedirect.tsx
If there are any questions, feedback, and or further improvements required please let me know 😄