From 19d351d157b8571308a039b9d2693983fb4aa5ac Mon Sep 17 00:00:00 2001 From: cofecatt <60803595+cofecatt@users.noreply.github.com> Date: Sat, 22 Oct 2022 20:46:50 +0800 Subject: [PATCH] feat: allow non-ASCII characters in username (#1235) --- object/check.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/object/check.go b/object/check.go index 44f8a311..c18403a0 100644 --- a/object/check.go +++ b/object/check.go @@ -326,6 +326,11 @@ func CheckUsername(username string) string { return "Username is too long (maximum is 39 characters)." } + exclude, _ := regexp.Compile("^[\u0021-\u007E]+$") + if !exclude.MatchString(username) { + return "" + } + // https://stackoverflow.com/questions/58726546/github-username-convention-using-regex re, _ := regexp.Compile("^[a-zA-Z0-9]+((?:-[a-zA-Z0-9]+)|(?:_[a-zA-Z0-9]+))*$") if !re.MatchString(username) {