Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const (
// Regular expression to match invalid characters in paths.
// It matches whitespace, control characters, non-printable characters, and specific Unicode characters.
regexInvalidPath = "\\s|[[:cntrl:]]|[[:space:]]|[[^:print:]]|ㅤ|\\.\\.|\\*"
regexLabelPattern = "^[a-zA-Z0-9]([a-zA-Z0-9-_]{0,254}[a-zA-Z0-9])?$"
regexLabelPattern = "^[a-zA-Z0-9]([a-zA-Z0-9-_.]{0,254}[a-zA-Z0-9])?$"
)

var viperInstance = viper.NewWithOptions(viper.KeyDelimiter(KeyDelimiter))
Expand Down
25 changes: 25 additions & 0 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,31 @@ func TestValidateLabel(t *testing.T) {
input: "label 123",
expected: false,
},
{
name: "Test 9: Valid label - cluster id",
input: "73623aef-1d5b-4f6b-b73d-5561c36851cc",
expected: true,
},
{
name: "Test 10: Valid label - installation name",
input: "my-release-nginx-ingress-controller",
expected: true,
},
{
name: "Test 11: Valid label - product",
input: "nic",
expected: true,
},
{
name: "Test 12: Valid label - version",
input: "5.3.0",
expected: true,
},
{
name: "Test 13: Valid label - version snapshot",
input: "5.3.0-SNAPSHOT",
expected: true,
},
}

for _, tt := range tests {
Expand Down
Loading