fix: support utf8mb4 across MySQL and MariaDB
This commit is contained in:
1 parent
cce17c5fa4
commit
d34894c9cd
28 files changed
+224
-121
No files matched your search
+3
-3
@@ -101,11 +101,11 @@ func auditFilterSQL(f auditFilter) (string, []any, error) {
|
||||
var conds []string
|
||||
var args []any
|
||||
if f.Zone != "" {
|
||||
conds = append(conds, "a.`zone` = ?")
|
||||
conds = append(conds, "a.`zone` = CAST(? AS BINARY)")
|
||||
args = append(args, f.Zone)
|
||||
}
|
||||
if f.Actor != "" {
|
||||
conds = append(conds, "a.`actor` = ?")
|
||||
conds = append(conds, "LOWER(CONVERT(a.`actor` USING utf8mb4) COLLATE utf8mb4_bin) = CAST(LOWER(CONVERT(? USING utf8mb4) COLLATE utf8mb4_bin) AS BINARY)")
|
||||
args = append(args, f.Actor)
|
||||
}
|
||||
if f.Operation != "" {
|
||||
@@ -141,7 +141,7 @@ func auditFilterSQL(f auditFilter) (string, []any, error) {
|
||||
args = append(args, f.BeforeID)
|
||||
}
|
||||
if f.RestrictToUserID.Valid {
|
||||
conds = append(conds, "(a.`user_id` = ? OR a.`zone` IN (SELECT d.`zone` FROM {delegations} d WHERE d.`user_id` = ?))")
|
||||
conds = append(conds, "(a.`user_id` = ? OR CAST(a.`zone` AS BINARY) IN (SELECT CAST(d.`zone` AS BINARY) FROM {delegations} d WHERE d.`user_id` = ?))")
|
||||
args = append(args, f.RestrictToUserID.Int64, f.RestrictToUserID.Int64)
|
||||
}
|
||||
if len(conds) == 0 {
|
||||
|
||||
Reference in new issue
Block a user