mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Fix non-ASCII search on database (#18437)
Use `ToASCIIUpper` for SQLite database on issues search, this because `UPPER(x)` on SQLite only transforms ASCII letters. Resolves #18429
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/references"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
@@ -1862,7 +1863,12 @@ func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen,
|
||||
func SearchIssueIDsByKeyword(ctx context.Context, kw string, repoIDs []int64, limit, start int) (int64, []int64, error) {
|
||||
repoCond := builder.In("repo_id", repoIDs)
|
||||
subQuery := builder.Select("id").From("issue").Where(repoCond)
|
||||
kw = strings.ToUpper(kw)
|
||||
// SQLite's UPPER function only transforms ASCII letters.
|
||||
if setting.Database.UseSQLite3 {
|
||||
kw = util.ToUpperASCII(kw)
|
||||
} else {
|
||||
kw = strings.ToUpper(kw)
|
||||
}
|
||||
cond := builder.And(
|
||||
repoCond,
|
||||
builder.Or(
|
||||
|
Reference in New Issue
Block a user