Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit da9e7b7

Browse files
committedJun 23, 2024·
Merge branch 'main' into streamline-e2e-report
2 parents 8e6894e + 5ea7ab6 commit da9e7b7

File tree

25 files changed

+2003
-1306
lines changed

25 files changed

+2003
-1306
lines changed
 

‎.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "5.3.2"
2+
".": "5.3.3"
33
}

‎CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## [5.3.3](https://github.com/netlify/next-runtime/compare/v5.3.2...v5.3.3) (2024-06-18)
4+
5+
6+
### Bug Fixes
7+
8+
* middleware i18n normalization ([#2483](https://github.com/netlify/next-runtime/issues/2483)) ([a9efa9c](https://github.com/netlify/next-runtime/commit/a9efa9c91f3796760ed8acdf0d3340dbe66ea329))
9+
* set systemlogger debug log level for debug requests ([#571](https://github.com/netlify/next-runtime/issues/571)) ([a6d09f3](https://github.com/netlify/next-runtime/commit/a6d09f3994bffdb40ef3bf3e5882e9195c1fff4a))
10+
* update cache handler to accomodate changes in next@canary ([#2480](https://github.com/netlify/next-runtime/issues/2480)) ([f4eeaa2](https://github.com/netlify/next-runtime/commit/f4eeaa2eb41180409b41fcd44e0c2ebc05025a49))
11+
* update in-memory prerender manifest with information from full route cache ([#579](https://github.com/netlify/next-runtime/issues/579)) ([c91e257](https://github.com/netlify/next-runtime/commit/c91e2575dd5b5faee6d9cb67f92def5171462015))
12+
313
## [5.3.2](https://github.com/netlify/next-runtime/compare/v5.3.1...v5.3.2) (2024-05-28)
414

515
### Bug Fixes

‎e2e-report/package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎e2e-report/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"@netlify/plugin-nextjs": "^5.3.2",
12+
"@netlify/plugin-nextjs": "^5.3.3",
1313
"next": "^14.2.3",
1414
"react": "^18.3.1",
1515
"react-dom": "^18.3.1"

‎edge-runtime/lib/next-request.ts

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import type { Context } from '@netlify/edge-functions'
22

3-
import { addBasePath, normalizeDataUrl, normalizeLocalePath, removeBasePath } from './util.ts'
3+
import {
4+
addBasePath,
5+
addTrailingSlash,
6+
normalizeDataUrl,
7+
normalizeLocalePath,
8+
removeBasePath,
9+
} from './util.ts'
410

511
interface I18NConfig {
612
defaultLocale: string
@@ -41,43 +47,25 @@ const normalizeRequestURL = (
4147
): { url: string; detectedLocale?: string } => {
4248
const url = new URL(originalURL)
4349

44-
url.pathname = removeBasePath(url.pathname, nextConfig?.basePath)
45-
const didRemoveBasePath = url.toString() !== originalURL
50+
let pathname = removeBasePath(url.pathname, nextConfig?.basePath)
4651

47-
let detectedLocale: string | undefined
48-
49-
if (nextConfig?.i18n) {
50-
const { pathname, detectedLocale: detected } = normalizeLocalePath(
51-
url.pathname,
52-
nextConfig?.i18n?.locales,
53-
)
54-
if (!nextConfig?.skipMiddlewareUrlNormalize) {
55-
url.pathname = pathname || '/'
56-
}
57-
detectedLocale = detected
58-
}
52+
// If it exists, remove the locale from the URL and store it
53+
const { detectedLocale } = normalizeLocalePath(pathname, nextConfig?.i18n?.locales)
5954

6055
if (!nextConfig?.skipMiddlewareUrlNormalize) {
6156
// We want to run middleware for data requests and expose the URL of the
6257
// corresponding pages, so we have to normalize the URLs before running
6358
// the handler.
64-
url.pathname = normalizeDataUrl(url.pathname)
59+
pathname = normalizeDataUrl(pathname)
6560

6661
// Normalizing the trailing slash based on the `trailingSlash` configuration
6762
// property from the Next.js config.
68-
if (nextConfig?.trailingSlash && url.pathname !== '/' && !url.pathname.endsWith('/')) {
69-
url.pathname = `${url.pathname}/`
63+
if (nextConfig?.trailingSlash) {
64+
pathname = addTrailingSlash(pathname)
7065
}
7166
}
7267

73-
if (didRemoveBasePath) {
74-
url.pathname = addBasePath(url.pathname, nextConfig?.basePath)
75-
}
76-
77-
// keep the locale in the url for request.nextUrl object
78-
if (detectedLocale) {
79-
url.pathname = `/${detectedLocale}${url.pathname}`
80-
}
68+
url.pathname = addBasePath(pathname, nextConfig?.basePath)
8169

8270
return {
8371
url: url.toString(),

0 commit comments

Comments
 (0)
Please sign in to comment.