Skip to content

Commit

Permalink
Update name validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
beornf committed Oct 5, 2024
1 parent 21eb9c6 commit 2aaff87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

var (
validEnvName = regexp.MustCompile(`^[A-Z0-9-_]+$`)
validName = regexp.MustCompile(`^[a-z][a-z0-9-_]*$`)
validName = regexp.MustCompile(`^[a-z0-9]([a-z0-9-]*[a-z0-9])?$`)
validPath = regexp.MustCompile(`^(/[a-zA-Z0-9-_]+)+$`)
)

Expand Down Expand Up @@ -472,7 +472,7 @@ func validateEnvName(val interface{}) error {

func validateName(val interface{}) error {
if !validName.MatchString(val.(string)) {
return errors.New("Name must start with a-z followed by a-z, 0-9, dash (-) or underscore (_)")
return errors.New("Name must only contain a-z, 0-9 or dash (-), and must start and end with a-z or 0-9")
}
return nil
}
Expand Down

0 comments on commit 2aaff87

Please sign in to comment.