Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
EVEREST-271 fix name starts with a digit
Browse files Browse the repository at this point in the history
  • Loading branch information
oksana-grishchenko committed Sep 14, 2023
1 parent 193ec3b commit 89c890e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func validateRFC1123(s, name string) error {
return ErrNameTooLong(name)
}

rfc1123Regex := "^[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?$"
rfc1123Regex := "^[a-z]([-a-z0-9]{0,61}[a-z0-9])?$"
re := regexp.MustCompile(rfc1123Regex)
if !re.MatchString(s) {
return ErrNameNotRFC1123Compatible(name)
Expand Down
6 changes: 5 additions & 1 deletion api/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ func TestValidateRFC1123(t *testing.T) {
valid: false,
},
{
value: "1abc-sAAf12",
value: "abc-sAAf12",
valid: false,
},
{
value: "1abc-sf12",
valid: false,
},
{
Expand Down

0 comments on commit 89c890e

Please sign in to comment.