From 83352d77f5cd08c2740661dc8096d7d289f8f130 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Tue, 22 Aug 2023 11:11:20 +0200 Subject: [PATCH] :bug: (customDomains) Transform name to lower case before validating --- packages/schemas/features/customDomains.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/schemas/features/customDomains.ts b/packages/schemas/features/customDomains.ts index 5984ee978..ab5118f94 100644 --- a/packages/schemas/features/customDomains.ts +++ b/packages/schemas/features/customDomains.ts @@ -4,7 +4,10 @@ import { z } from 'zod' const domainNameRegex = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/ export const customDomainSchema = z.object({ - name: z.string().refine((name) => domainNameRegex.test(name)), + name: z + .string() + .transform((name) => name.toLowerCase()) + .refine((name) => domainNameRegex.test(name)), workspaceId: z.string(), createdAt: z.date(), }) satisfies z.ZodType