diff --git a/apps/web/components/eventtype/EventSetupTab.tsx b/apps/web/components/eventtype/EventSetupTab.tsx
index 754f060868..67e8fde94b 100644
--- a/apps/web/components/eventtype/EventSetupTab.tsx
+++ b/apps/web/components/eventtype/EventSetupTab.tsx
@@ -30,8 +30,7 @@ import {
Button,
showToast,
} from "@calcom/ui";
-import { Plus, X, Check } from "@calcom/ui/components/icon";
-import { CornerDownRight } from "@calcom/ui/components/icon";
+import { Plus, X, Check, CornerDownRight } from "@calcom/ui/components/icon";
import CheckboxField from "@components/ui/form/CheckboxField";
import type { SingleValueLocationOption } from "@components/ui/form/LocationSelect";
@@ -200,23 +199,15 @@ export const EventSetupTab = (
defaultValue={defaultValue}
render={({ field: { onChange, value } }) => {
return (
- <>
-
-
- >
+
);
}}
/>
@@ -231,21 +222,13 @@ export const EventSetupTab = (
defaultValue={defaultValue}
render={({ field: { onChange, value } }) => {
return (
- <>
-
-
- >
+
);
}}
/>
@@ -320,11 +303,11 @@ export const EventSetupTab = (
{eventLocationType?.organizerInputType && (
-
-
-
-
-
+
{
teamName: z.string().optional(),
})
.passthrough()
+ .superRefine((val, ctx) => {
+ if (val?.link) {
+ const link = val.link;
+ const eventLocationType = getEventLocationType(val.type);
+ if (
+ eventLocationType &&
+ !eventLocationType.default &&
+ eventLocationType.linkType === "static" &&
+ eventLocationType.urlRegExp
+ ) {
+ const valid = z
+ .string()
+ .regex(new RegExp(eventLocationType.urlRegExp))
+ .safeParse(link).success;
+
+ if (!valid) {
+ const sampleUrl = eventLocationType.organizerInputPlaceholder;
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: [eventLocationType.defaultValueVariable],
+ message: `Invalid URL for ${eventLocationType.label}. ${
+ sampleUrl ? `Sample URL: ${sampleUrl}` : ""
+ }`,
+ });
+ }
+ return;
+ }
+
+ const valid = z.string().url().optional().safeParse(val).success;
+ if (!valid) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: [eventLocationType.defaultValueVariable],
+ message: `Invalid URL`,
+ });
+ }
+ }
+ return;
+ })
)
.optional(),
})