-
-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: crash with invalid locale cookie + no_prefix strategy + SEO (#666)
The SEO code has crashed due to trying to get `iso` property for locale that didn't exist. It's because we've allowed to set `$i18n.locale` to an invalid value due to not validating the locale cookie in all cases. This crash only triggered when certain conditions have aligned: - using `no_prefix` strategy as then middleware can't get locale from route - using `detectBrowserLanguage.alwaysRedirect` as then we try to redirect even when cookie is already set - using `seo = true` or manual SEO integration as the crash happened in SEO code Change `getLocaleCookie` to only return locale code if it's valid.
- Loading branch information
Showing
2 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters