From 9a671f906307940089b5f345a4d6287bbde38f46 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Tue, 13 May 2025 21:57:00 -0400 Subject: [PATCH] fix: add arg validation to ensureValidPhoneNumber (#21259) --- packages/features/bookings/lib/getBookingResponsesSchema.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/features/bookings/lib/getBookingResponsesSchema.ts b/packages/features/bookings/lib/getBookingResponsesSchema.ts index bb3a18d014..d33ecf566c 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(/^ +/, "+");