Update internal/codespaces/rpc/invoker.go

Co-authored-by: Caleb Brose <5447118+cmbrose@users.noreply.github.com>
This commit is contained in:
Sarah Barili 2024-11-08 09:11:44 -07:00 committed by GitHub
parent 6d5a26cfd1
commit a02f84528a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -307,7 +307,7 @@ func (i *invoker) notifyCodespaceOfClientActivity(ctx context.Context, activity
func isUsernameValid(username string) bool {
// assuming valid usernames are alphanumeric, with these special characters allowed: . _ -
var validUsernamePattern = `^[a-zA-Z0-9._-]+$`
var validUsernamePattern = `^[a-zA-Z0-9_][-.a-zA-Z0-9_]*$`
re := regexp.MustCompile(validUsernamePattern)
return re.MatchString(username)
}