Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into v4
Browse files Browse the repository at this point in the history
# Conflicts:
#	docs/src/pages/docs/workflows/typescript.mdx
  • Loading branch information
amannn committed Nov 15, 2024
2 parents 7d89d54 + 140ef46 commit c2a8984
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 3.25.1 (2024-11-13)

### Bug Fixes

* 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

## 3.25.0 (2024-11-08)

### Features
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json",
"version": "3.25.0",
"version": "3.25.1",
"packages": [
"packages/*"
],
Expand Down
6 changes: 6 additions & 0 deletions packages/next-intl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 3.25.1 (2024-11-13)

### Bug Fixes

* 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

## 3.25.0 (2024-11-08)

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/next-intl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-intl",
"version": "3.25.0",
"version": "3.25.1",
"sideEffects": false,
"author": "Jan Amann <[email protected]>",
"funding": [
Expand Down
14 changes: 14 additions & 0 deletions packages/next-intl/src/middleware/middleware.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,20 @@ describe('prefix-based routing', () => {
'http://localhost:3000/en/'
);
});

it('keeps search params when redirecting to a locale at the root', () => {
middleware(createMockRequest('/?sort=asc'));
expect(MockedNextResponse.redirect.mock.calls[0][0].toString()).toBe(
'http://localhost:3000/en/?sort=asc'
);
});

it('keeps search params when redirecting to a locale', () => {
middleware(createMockRequest('/users?sort=asc'));
expect(MockedNextResponse.redirect.mock.calls[0][0].toString()).toBe(
'http://localhost:3000/en/users/?sort=asc'
);
});
});

describe('localized pathnames', () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/next-intl/src/middleware/middleware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export default function createMiddleware<
}

function redirect(url: string, redirectDomain?: string) {
const urlObj = new URL(normalizeTrailingSlash(url), request.url);
const urlObj = new URL(url, request.url);

urlObj.pathname = normalizeTrailingSlash(urlObj.pathname);

if (domainsConfig.length > 0 && !redirectDomain && domain) {
const bestMatchingDomain = getBestMatchingDomain(
Expand Down
6 changes: 6 additions & 0 deletions packages/use-intl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 3.25.1 (2024-11-13)

### Bug Fixes

* 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

## 3.25.0 (2024-11-08)

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/use-intl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "use-intl",
"version": "3.25.0",
"version": "3.25.1",
"sideEffects": false,
"author": "Jan Amann <[email protected]>",
"description": "Internationalization (i18n) for React",
Expand Down

0 comments on commit c2a8984

Please sign in to comment.