Skip to content

Commit

Permalink
Add anchors to name regex
Browse files Browse the repository at this point in the history
apparently validate_format doesn't default to whole-string matches, regex anchors solve for that
  • Loading branch information
michaeljguarino committed Oct 27, 2024
1 parent 20083a1 commit dc29cdf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/core/lib/core/schema/console_instance.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit dc29cdf

Please sign in to comment.