mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 19:06:18 +01: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:
		| @@ -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) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user