fix: decode params used in query object in buildLegacyCtx (#19253)

* fix: decode params used in query object in buildLegacyCtx

* add tests

* fix
This commit is contained in:
Benny Joo
2025-02-12 07:58:46 +00:00
committed by GitHub
parent e800341485
commit 4fbeff31e7
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ export const buildLegacyCtx = (
searchParams: SearchParams
) => {
return {
query: { ...searchParams, ...params },
query: { ...searchParams, ...decodeParams(params) },
// decoding is required to be backward compatible with Pages Router
// because Next.js App Router does not auto-decode query params while Pages Router does
// e.g., params: { name: "John%20Doe" } => params: { name: "John Doe" }
+14
View File
@@ -63,6 +63,20 @@ test("check SSR and OG - User Event Type", async ({ page, users }) => {
todo("check SSR and OG - Team Event Type");
test.describe("user with a special character in the username", () => {
test("/[user] page shouldn't 404", async ({ page, users }) => {
const user = await users.create({ username: "franz-janßen" });
const response = await page.goto(`/${user.username}`);
expect(response?.status()).not.toBe(404);
});
test("/[user]/[type] page shouldn't 404", async ({ page, users }) => {
const user = await users.create({ username: "franz-janßen" });
const response = await page.goto(`/${user.username}/30-min`);
expect(response?.status()).not.toBe(404);
});
});
test.describe("free user", () => {
test.beforeEach(async ({ page, users }) => {
const free = await users.create(freeUserObj);