-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify milestone search keywords to be case insensitive again (#20513)
Co-authored-by: 6543 <[email protected]> Co-authored-by: delvh <[email protected]>
- Loading branch information
1 parent
2c108d2
commit 8e3da0e
Showing
3 changed files
with
27 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2022 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package db | ||
|
||
import ( | ||
"strings" | ||
|
||
"code.gitea.io/gitea/modules/setting" | ||
"code.gitea.io/gitea/modules/util" | ||
|
||
"xorm.io/builder" | ||
) | ||
|
||
// BuildCaseInsensitiveLike returns a condition to check if the given value is like the given key case-insensitively. | ||
// Handles especially SQLite correctly as UPPER there only transforms ASCII letters. | ||
func BuildCaseInsensitiveLike(key, value string) builder.Cond { | ||
if setting.Database.UseSQLite3 { | ||
return builder.Like{"UPPER(" + key + ")", util.ToUpperASCII(value)} | ||
} | ||
return builder.Like{"UPPER(" + key + ")", strings.ToUpper(value)} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters