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:
@@ -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" }
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user