forked from forgejo/forgejo
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:
parent
7f2530e004
commit
bb5f859ec0
3 changed files with 52 additions and 1 deletions
|
@ -170,3 +170,14 @@ func CryptoRandomBytes(length int64) ([]byte, error) {
|
|||
_, err := rand.Read(buf)
|
||||
return buf, err
|
||||
}
|
||||
|
||||
// ToUpperASCII returns s with all ASCII letters mapped to their upper case.
|
||||
func ToUpperASCII(s string) string {
|
||||
b := []byte(s)
|
||||
for i, c := range b {
|
||||
if 'a' <= c && c <= 'z' {
|
||||
b[i] -= 'a' - 'A'
|
||||
}
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue