fix: toLowerCase/slugify of booking page params (#9903)

* fix: toLowerCase/slugify of booking page params

* Ensure support for dynamic events
This commit is contained in:
Alex van Andel authored and GitHub committed 2023-07-03 23:22:27 -04:00
1 parent fefb297c47
commit b137c87634
4 files changed
+22 -21

No files matched your search

+3 -8
View File
@@ -2,6 +2,7 @@ import type { Prisma, Credential } from "@prisma/client";
import { DailyLocationType } from "@calcom/app-store/locations";
import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields";
import slugify from "@calcom/lib/slugify";
import { PeriodType, SchedulingType } from "@calcom/prisma/enums";
import type { userSelect } from "@calcom/prisma/selects";
import type { CustomInputSchema } from "@calcom/prisma/zod-utils";
@@ -177,14 +178,8 @@ export const getUsernameList = (users: string | string[] | undefined): string[]
// So, even though this code handles even if individual user is dynamic link, that isn't a possibility right now.
users = arrayCast(users);
const allUsers = users.map((user) =>
user
.toLowerCase()
.replace(/( |%20|%2b)/g, "+")
.split("+")
);
return Array.prototype.concat(...allUsers);
const allUsers = users.map((user) => user.split("+")).flat();
return Array.prototype.concat(...allUsers.map((userSlug) => slugify(userSlug)));
};
export default defaultEvents;