From 252795ce346c6e7b7835357a54709d6bdd284916 Mon Sep 17 00:00:00 2001 From: Jan Taras Date: Fri, 14 Jun 2024 13:56:47 +0200 Subject: [PATCH] fix: dashes in tags allowed everywhere but at the start of tag --- proxmox/type_tag.go | 4 ++-- test/data/test_data_tag/type_Tag.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/proxmox/type_tag.go b/proxmox/type_tag.go index 8c355eec..39ea9d1c 100644 --- a/proxmox/type_tag.go +++ b/proxmox/type_tag.go @@ -9,11 +9,11 @@ import ( type Tag string var ( - regexTag = regexp.MustCompile(`^[a-z0-9_]+$`) + regexTag = regexp.MustCompile(`^[a-z0-9_][a-z0-9_-]*$`) ) const ( - Tag_Error_Invalid string = "tag may only include the following characters: abcdefghijklmnopqrstuvwxyz0123456789_" + Tag_Error_Invalid string = "tag may not start with - and may only include the following characters: abcdefghijklmnopqrstuvwxyz0123456789_-" Tag_Error_Duplicate string = "duplicate tag found" Tag_Error_MaxLength string = "tag may only be 124 characters" Tag_Error_Empty string = "tag may not be empty" diff --git a/test/data/test_data_tag/type_Tag.go b/test/data/test_data_tag/type_Tag.go index a0b15cae..c2a64869 100644 --- a/test/data/test_data_tag/type_Tag.go +++ b/test/data/test_data_tag/type_Tag.go @@ -22,7 +22,6 @@ func Tag_Character_Illegal() []string { `Tag'Name`, `Tag~Name`, `Name