The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Improve URL validation and error handling in branding form (#3007)
Kiran K0153f06bbabb
diff --git a/apps/web/lib/zod/schemas/program-lander.ts b/apps/web/lib/zod/schemas/program-lander.tsindex 30bae9b129..3397eb1763 100644--- a/apps/web/lib/zod/schemas/program-lander.ts+++ b/apps/web/lib/zod/schemas/program-lander.ts@@ -30,7 +30,12 @@ export const programLanderFileSchema = z.object({id: z.string(),name: z.string(),description: z.string().optional(),- url: z.string().url(),+ url: z+ .string()+ .url()+ .refine((url) => url.startsWith("http://") || url.startsWith("https://"), {+ message: "Only HTTP and HTTPS URLs are allowed for files.",+ }),external: z.boolean().optional(),});diff --git a/apps/web/ui/partners/groups/design/branding-form.tsx b/apps/web/ui/partners/groups/design/branding-form.tsxindex d60b7011f6..ed39adb6fd 100644--- a/apps/web/ui/partners/groups/design/branding-form.tsx+++ b/apps/web/ui/partners/groups/design/branding-form.tsx@@ -231,7 +231,9 @@ function BrandingFormInner({});},onError({ error }) {- console.error(error);+ const message = error.serverError || "Failed to update application form.";+ toast.error(message);+ setError("root", { message });},});@@ -268,8 +270,6 @@ function BrandingFormInner({});if (!result?.data?.success) {- toast.error("Failed to update application form.");- setError("root", { message: "Failed to update application form." });return;}