Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c7c35ef commit 63c60d8Copy full SHA for 63c60d8
codersdk/name.go
@@ -10,7 +10,7 @@ import (
10
)
11
12
var (
13
- UsernameValidRegex = regexp.MustCompile("^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$")
+ UsernameValidRegex = regexp.MustCompile("^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*-?$")
14
usernameReplace = regexp.MustCompile("[^a-zA-Z0-9-]*")
15
16
templateVersionName = regexp.MustCompile(`^[a-zA-Z0-9]+(?:[_.-]{1}[a-zA-Z0-9]+)*$`)
codersdk/name_test.go
@@ -34,6 +34,7 @@ func TestUsernameValid(t *testing.T) {
34
{"abcdefghijklmnopqrst", true},
35
{"abcdefghijklmnopqrstu", true},
36
{"wow-test", true},
37
+ {"github-legacy-name-", true},
38
39
{"", false},
40
{" ", false},
0 commit comments