Skip to content

Commit

Permalink
Merge pull request #342 from TarasJan/fix/tags_with_dash
Browse files Browse the repository at this point in the history
fix: dashes in tags allowed everywhere but at the start of tag
  • Loading branch information
Tinyblargon committed Jun 15, 2024
2 parents 9d245a2 + 252795c commit 578dffa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions proxmox/type_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion test/data/test_data_tag/type_Tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ func Tag_Character_Illegal() []string {
`Tag'Name`,
`Tag~Name`,
`Name<Tag`,
`dash-first`,
`tag.with.dot`,
`tag,with,comma`,
`tag:name`,
`Tag?`,
`Tag[Bracket]`,
`Tag{Name}`,
`!InvalidTag`,
`-StartWithDashTag`,
}, Tag_Illegal())
}

Expand Down Expand Up @@ -64,5 +64,6 @@ func Tag_Legal() []string {
`programming`,
`python`,
`72d1109e_97f6_41e7_96cc_18a8b7dc19dc`,
`dash-tag`,
}, Tag_Max_Legal())
}

0 comments on commit 578dffa

Please sign in to comment.