mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-29 04:27:17 +00:00
fix🐛: truncate opera log jsonResult by rune to keep valid UTF-8
This commit is contained in:
@@ -75,9 +75,10 @@ func SaveOperaLog(message storage.Messager) (err error) {
|
||||
return nil
|
||||
}
|
||||
// 超出100个字符返回值截断
|
||||
if len(l.JsonResult) > 100 {
|
||||
l.JsonResult = l.JsonResult[:100]
|
||||
if r := []rune(l.JsonResult); len(r) > 100 {
|
||||
l.JsonResult = string(r[:100])
|
||||
}
|
||||
|
||||
err = db.Create(&l).Error
|
||||
if err != nil {
|
||||
log.Errorf("db create error, %s", err.Error())
|
||||
|
||||
Reference in New Issue
Block a user