From dc29cdf663d3f927d0f8da444788f6081b1663cb Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Sun, 27 Oct 2024 10:18:54 -0400 Subject: [PATCH] Add anchors to name regex apparently validate_format doesn't default to whole-string matches, regex anchors solve for that --- apps/core/lib/core/schema/console_instance.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/core/lib/core/schema/console_instance.ex b/apps/core/lib/core/schema/console_instance.ex index dcfeb678f..c6c974c3f 100644 --- a/apps/core/lib/core/schema/console_instance.ex +++ b/apps/core/lib/core/schema/console_instance.ex @@ -119,7 +119,7 @@ defmodule Core.Schema.ConsoleInstance do |> foreign_key_constraint(:owner_id) |> unique_constraint(:subdomain) |> unique_constraint(:name) - |> validate_format(:name, ~r/[a-z][a-z0-9]{5,10}/, message: "must be an alphanumeric string between 5 and 11 characters") + |> validate_format(:name, ~r/^[a-z][a-z0-9]{5,10}$/, message: "must be an alphanumeric string between 5 and 11 characters") |> validate_region() end