Skip to content

Commit c2a8984

Browse files
committed
Merge remote-tracking branch 'origin/main' into v4
# Conflicts: # docs/src/pages/docs/workflows/typescript.mdx
2 parents 7d89d54 + 140ef46 commit c2a8984

File tree

8 files changed

+38
-4
lines changed

8 files changed

+38
-4
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## 3.25.1 (2024-11-13)
7+
8+
### Bug Fixes
9+
10+
* Correctly handle search params in redirects when using `trailingSlash: true` ([#1537](https://github.com/amannn/next-intl/issues/1537)) ([03a4620](https://github.com/amannn/next-intl/commit/03a4620432ff063b2b84f4dba5c49ae36b92fd73)) – by @deini
11+
612
## 3.25.0 (2024-11-08)
713

814
### Features

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json",
3-
"version": "3.25.0",
3+
"version": "3.25.1",
44
"packages": [
55
"packages/*"
66
],

packages/next-intl/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## 3.25.1 (2024-11-13)
7+
8+
### Bug Fixes
9+
10+
* Correctly handle search params in redirects when using `trailingSlash: true` ([#1537](https://github.com/amannn/next-intl/issues/1537)) ([03a4620](https://github.com/amannn/next-intl/commit/03a4620432ff063b2b84f4dba5c49ae36b92fd73)) – by @deini
11+
612
## 3.25.0 (2024-11-08)
713

814
### Features

packages/next-intl/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "next-intl",
3-
"version": "3.25.0",
3+
"version": "3.25.1",
44
"sideEffects": false,
55
"author": "Jan Amann <jan@amann.work>",
66
"funding": [

packages/next-intl/src/middleware/middleware.test.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,20 @@ describe('prefix-based routing', () => {
11431143
'http://localhost:3000/en/'
11441144
);
11451145
});
1146+
1147+
it('keeps search params when redirecting to a locale at the root', () => {
1148+
middleware(createMockRequest('/?sort=asc'));
1149+
expect(MockedNextResponse.redirect.mock.calls[0][0].toString()).toBe(
1150+
'http://localhost:3000/en/?sort=asc'
1151+
);
1152+
});
1153+
1154+
it('keeps search params when redirecting to a locale', () => {
1155+
middleware(createMockRequest('/users?sort=asc'));
1156+
expect(MockedNextResponse.redirect.mock.calls[0][0].toString()).toBe(
1157+
'http://localhost:3000/en/users/?sort=asc'
1158+
);
1159+
});
11461160
});
11471161

11481162
describe('localized pathnames', () => {

packages/next-intl/src/middleware/middleware.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ export default function createMiddleware<
9191
}
9292

9393
function redirect(url: string, redirectDomain?: string) {
94-
const urlObj = new URL(normalizeTrailingSlash(url), request.url);
94+
const urlObj = new URL(url, request.url);
95+
96+
urlObj.pathname = normalizeTrailingSlash(urlObj.pathname);
9597

9698
if (domainsConfig.length > 0 && !redirectDomain && domain) {
9799
const bestMatchingDomain = getBestMatchingDomain(

packages/use-intl/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## 3.25.1 (2024-11-13)
7+
8+
### Bug Fixes
9+
10+
* Correctly handle search params in redirects when using `trailingSlash: true` ([#1537](https://github.com/amannn/next-intl/issues/1537)) ([03a4620](https://github.com/amannn/next-intl/commit/03a4620432ff063b2b84f4dba5c49ae36b92fd73)) – by @deini
11+
612
## 3.25.0 (2024-11-08)
713

814
### Features

packages/use-intl/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "use-intl",
3-
"version": "3.25.0",
3+
"version": "3.25.1",
44
"sideEffects": false,
55
"author": "Jan Amann <jan@amann.work>",
66
"description": "Internationalization (i18n) for React",

0 commit comments

Comments
 (0)