From 89c890efd75ac159f75bd579a91d5c314b9c4b9c Mon Sep 17 00:00:00 2001 From: Oksana Grishchenko Date: Thu, 14 Sep 2023 08:32:39 +0200 Subject: [PATCH] EVEREST-271 fix name starts with a digit --- api/validation.go | 2 +- api/validation_test.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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, }, {