From 24d1c814634331fef29556a01fd4845a29af6813 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Thu, 20 Jan 2022 11:24:23 +0800 Subject: [PATCH] #1401 fix bug --- routers/repo/repo.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index a509cb52e..70705dcf1 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -13,6 +13,7 @@ import ( "path" "regexp" "strings" + "unicode/utf8" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" @@ -566,7 +567,7 @@ func CheckName(ctx *context.Context) { var r = make(map[string]string, 1) q := ctx.Query("q") owner := ctx.Query("owner") - if q == "" || owner == "" || len(q) > 100 || !validation.ValidAlphaDashDotChinese(q) { + if q == "" || owner == "" || utf8.RuneCountInString(q) > 100 || !validation.ValidAlphaDashDotChinese(q) { r["name"] = "" ctx.JSON(200, r) return