Skip to content
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: prevent strategy no_prefix redirect detection locale change attempt #2505

Merged

Conversation

BobbieGoede
Copy link
Collaborator

πŸ”— Linked issue

#2493

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Resolves #2493

It looks like detectRedirect tried to change locale based on route while using no_prefix strategy. This causes issues as we can't retrieve the locale from unprefixed paths.

This resolves the referenced issue but potentially a related/underlying issue remains. When resolving the routePath here: https://github.com/nuxt-modules/i18n/blob/main/src/runtime/utils.ts#L315-L323 on url with a trailing slash will cause a redirect as routePath will resolve to the same path without a trailing slash. In the case of the referenced issue this logic is never hit as the locale does not change.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link
Collaborator

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!
I'm happy to you worked on routing.
nuxt i18n routing is difficult that has some strategies and complex.
LGTM!

@kazupon kazupon merged commit b4a5692 into nuxt-modules:main Oct 19, 2023
7 checks passed
@MaxCpp
Copy link

MaxCpp commented Nov 15, 2023

Sorry, when this fix release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

This module breaks ":to" links in nuxt v3
3 participants