From c412e7f8159e52426bf52b15550b39b1de5d12ed Mon Sep 17 00:00:00 2001 From: Afrie Irham <32460534+afrieirham@users.noreply.github.com> Date: Mon, 3 Jul 2023 16:13:22 +0800 Subject: [PATCH] fix: URL case sensitive bug (#9886) --- apps/web/pages/new-booker/[user]/[type].tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/web/pages/new-booker/[user]/[type].tsx b/apps/web/pages/new-booker/[user]/[type].tsx index d74a879baf..e075748e8e 100644 --- a/apps/web/pages/new-booker/[user]/[type].tsx +++ b/apps/web/pages/new-booker/[user]/[type].tsx @@ -93,16 +93,18 @@ async function getDynamicGroupPageProps(context: GetServerSidePropsContext) { } async function getUserPageProps(context: GetServerSidePropsContext) { - const { user: username, type: slug } = paramsSchema.parse(context.params); + const { user: uname, type: slug } = paramsSchema.parse(context.params); const { rescheduleUid } = context.query; const { currentOrgDomain, isValidOrgDomain } = orgDomainConfig(context.req.headers.host ?? ""); + /** TODO: We should standarize this */ + const username = uname.toLowerCase().replace(/( |%20)/g, "+"); + const { ssrInit } = await import("@server/lib/ssr"); const ssr = await ssrInit(context); const user = await prisma.user.findFirst({ where: { - /** TODO: We should standarize this */ - username: username.toLowerCase().replace(/( |%20)/g, "+"), + username, organization: isValidOrgDomain ? { slug: currentOrgDomain,