mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08: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