From e0f35ea00f03a6b4644701947e11e6d1e5167624 Mon Sep 17 00:00:00 2001 From: Tyrone Yeh Date: Wed, 27 Jul 2022 19:55:09 +0800 Subject: [PATCH] Modify milestone search keywords to be case insensitive (#20266) (#20498) * Modify milestone search keywords to be case insensitive (#20266) Milestone search keywords are now sensitive, this modification is changed to insensitive * Modify for #18437 Co-authored-by: Lunny Xiao --- models/issues/milestone.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/models/issues/milestone.go b/models/issues/milestone.go index fba599e6ec..4197fb9120 100644 --- a/models/issues/milestone.go +++ b/models/issues/milestone.go @@ -15,6 +15,7 @@ import ( "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" "xorm.io/builder" ) @@ -361,7 +362,11 @@ func (opts GetMilestonesOption) toCond() builder.Cond { } if len(opts.Name) != 0 { - cond = cond.And(builder.Like{"name", opts.Name}) + if setting.Database.UseSQLite3 { + cond = cond.And(builder.Like{"UPPER(name)", util.ToUpperASCII(opts.Name)}) + } else { + cond = cond.And(builder.Like{"UPPER(name)", strings.ToUpper(opts.Name)}) + } } return cond