From 55e1f865d8481814ecae1e23654e8a9a7bb4fdf4 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 28 Aug 2024 07:26:50 -0500 Subject: [PATCH] Don't allow periods in zone or camera group names (#13400) --- web/src/components/filter/CameraGroupSelector.tsx | 8 ++++++++ web/src/components/settings/ZoneEditPane.tsx | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/web/src/components/filter/CameraGroupSelector.tsx b/web/src/components/filter/CameraGroupSelector.tsx index f6a5c5fdf..6f14b8eb9 100644 --- a/web/src/components/filter/CameraGroupSelector.tsx +++ b/web/src/components/filter/CameraGroupSelector.tsx @@ -551,6 +551,14 @@ export function CameraGroupEdit({ message: "Camera group name already exists.", }, ) + .refine( + (value: string) => { + return !value.includes("."); + }, + { + message: "Camera group name must not contain a period.", + }, + ) .refine((value: string) => value.toLowerCase() !== "default", { message: "Invalid camera group name.", }), diff --git a/web/src/components/settings/ZoneEditPane.tsx b/web/src/components/settings/ZoneEditPane.tsx index b80fa933e..f1c23c705 100644 --- a/web/src/components/settings/ZoneEditPane.tsx +++ b/web/src/components/settings/ZoneEditPane.tsx @@ -106,6 +106,14 @@ export default function ZoneEditPane({ { message: "Zone name already exists on this camera.", }, + ) + .refine( + (value: string) => { + return !value.includes("."); + }, + { + message: "Zone name must not contain a period.", + }, ), inertia: z.coerce .number()