-
Notifications
You must be signed in to change notification settings - Fork 92
fix: middleware i18n normalization #2483
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
Conversation
📊 Package size report -0.01%↓
Unchanged files
🤖 This report was automatically generated by pkg-size-action |
edge-runtime/lib/next-request.ts
Outdated
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.
nit: This reads a bit weird. Could we do a regular assignment to detectLocale, or is the linter complaining about not using destructuring?
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.
Good point. I realised that normalizeLocalePath will return undefined for detectedLocale if nextConfig.i18n is undefined, so the conditional wasn't necessary, meaning I can use regular destructuring to a const. Fixed in 13a8cce
5abd081 to
13a8cce
Compare
Uh oh!
There was an error while loading. Please reload this page.
Description
Fixes a regression from a previous PR that manifests itself when using the
skipMiddlewareUrlNormalizeoption innext.config.js. In this scenario, the locale was being duplicated during middleware rewrites.The cause was incorrect URL normalization logic in the middleware request handling.
Tests
Integration tests added
Relevant links (GitHub issues, etc.) or a picture of cute animal
Fixes FRA-565