Skip to content

Scheduling infrastructure for absolutely everyone.

fix: add arg validation to ensureValidPhoneNumber (#21259)

Benny Joo9a671f906307
diff --git a/packages/features/bookings/lib/getBookingResponsesSchema.ts b/packages/features/bookings/lib/getBookingResponsesSchema.ts
index bb3a18d0146..d33ecf566c2 100644
--- a/packages/features/bookings/lib/getBookingResponsesSchema.ts
+++ b/packages/features/bookings/lib/getBookingResponsesSchema.ts
@@ -17,6 +17,7 @@ export const bookingResponsesDbSchema = z.record(dbReadResponseSchema);
const catchAllSchema = bookingResponsesDbSchema;
const ensureValidPhoneNumber = (value: string) => {
+ if (!value) return "";
// + in URL could be replaced with space, so we need to replace it back
// Replace the space(s) in the beginning with + as it is supposed to be provided in the beginning only
return value.replace(/^ +/, "+");