diff --git a/api/validation.go b/api/validation.go index 46cf556a..38319b69 100644 --- a/api/validation.go +++ b/api/validation.go @@ -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) diff --git a/api/validation_test.go b/api/validation_test.go index d3bb74ea..2abad525 100644 --- a/api/validation_test.go +++ b/api/validation_test.go @@ -45,7 +45,11 @@ func TestValidateRFC1123(t *testing.T) { valid: false, }, { - value: "1abc-sAAf12", + value: "abc-sAAf12", + valid: false, + }, + { + value: "1abc-sf12", valid: false, }, {