Trim group name before length validation (#17539)

This commit is contained in:
rossfoss
2025-04-05 01:39:31 +01:00
committed by GitHub
parent 7917ec611a
commit 1ef79ce5f1

View File

@@ -657,10 +657,11 @@ export function CameraGroupEdit({
const formSchema = z.object({ const formSchema = z.object({
name: z name: z
.string() .string()
.trim()
.min(2, { .min(2, {
message: t("group.name.errorMessage.mustLeastCharacters"), message: t("group.name.errorMessage.mustLeastCharacters"),
}) })
.transform((val: string) => val.trim().replace(/\s+/g, "_")) .transform((val: string) => val.replace(/\s+/g, "_"))
.refine( .refine(
(value: string) => { (value: string) => {
return ( return (