Skip to content

Scheduling infrastructure for absolutely everyone.

Fixes successRedirectUrl

zomars53de4ddaafe3
diff --git a/apps/web/pages/event-types/[type].tsx b/apps/web/pages/event-types/[type].tsx
index 99c1c5e95cd..2bcd7747fe6 100644
--- a/apps/web/pages/event-types/[type].tsx
+++ b/apps/web/pages/event-types/[type].tsx
@@ -854,7 +854,6 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
seatsPerTimeSlot,
recurringEvent,
locations,
- successRedirectUrl,
...input
} = values;
@@ -868,7 +867,6 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
id: eventType.id,
beforeEventBuffer: beforeBufferTime,
afterEventBuffer: afterBufferTime,
- successRedirectUrl: successRedirectUrl || undefined,
seatsPerTimeSlot,
metadata: {
...(smartContractAddress ? { smartContractAddress } : {}),
diff --git a/packages/prisma/zod-utils.ts b/packages/prisma/zod-utils.ts
index edfe7f61427..bb84f58211b 100644
--- a/packages/prisma/zod-utils.ts
+++ b/packages/prisma/zod-utils.ts
@@ -118,16 +118,12 @@ export const userMetadata = z
* - XSS attempts through javascript:alert('hi')
* - mailto: links
*/
-export function assertValidUrl(url: string | null | undefined) {
- if (!url) return false;
- return url.startsWith("http://") && url.startsWith("https://");
-}
-
export const successRedirectUrl = z
- .string()
- .url()
- .refine(assertValidUrl, {
- path: ["successRedirectUrl"],
- message: "Invalid URL",
- })
- .nullish();
+ .union([
+ z.literal(""),
+ z
+ .string()
+ .url()
+ .regex(/^http(s)?:\/\/.*/),
+ ])
+ .optional();