Skip to content

Commit 2e8bf1a

Browse files
committed
fix: allow short names like db
1 parent c3b0129 commit 2e8bf1a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

pkg/util/encoding/encoding.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ func Convert(ID string) string {
3434
return SafeConcatName(ID)
3535
}
3636

37-
// UnsafeNameRegEx checks for a valid name and needs to be url compatible
38-
var UnsafeNameRegEx = regexp.MustCompile(`^[a-z0-9][a-z0-9\-]+[a-z0-9]$`)
39-
var UnsafeUpperNameRegEx = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9\-_]+[A-Za-z0-9]$`)
37+
var UnsafeNameRegEx = regexp.MustCompile(`^[a-z0-9]+(?:-?[a-z0-9]+)*$`)
38+
var UnsafeUpperNameRegEx = regexp.MustCompile(`^[A-Za-z0-9]+(?:[\-_]?[A-Za-z0-9])*$`)
4039

4140
func IsUnsafeUpperName(unsafeName string) bool {
4241
return !UnsafeUpperNameRegEx.MatchString(unsafeName)

0 commit comments

Comments
 (0)