Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 63c60d8

Browse files
committed
allow github legacy names
1 parent c7c35ef commit 63c60d8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

codersdk/name.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
var (
13-
UsernameValidRegex = regexp.MustCompile("^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$")
13+
UsernameValidRegex = regexp.MustCompile("^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*-?$")
1414
usernameReplace = regexp.MustCompile("[^a-zA-Z0-9-]*")
1515

1616
templateVersionName = regexp.MustCompile(`^[a-zA-Z0-9]+(?:[_.-]{1}[a-zA-Z0-9]+)*$`)

codersdk/name_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func TestUsernameValid(t *testing.T) {
3434
{"abcdefghijklmnopqrst", true},
3535
{"abcdefghijklmnopqrstu", true},
3636
{"wow-test", true},
37+
{"github-legacy-name-", true},
3738

3839
{"", false},
3940
{" ", false},

0 commit comments

Comments
 (0)