Browse Source

修复文件上传记录body太大导致的数据库报错

main
SliverHorn 4 years ago
parent
commit
827a565a8a
  1. 5
      server/middleware/operation.go

5
server/middleware/operation.go

@ -11,6 +11,7 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strconv" "strconv"
"strings"
"time" "time"
) )
@ -45,6 +46,10 @@ func OperationRecord() gin.HandlerFunc {
Body: string(body), Body: string(body),
UserID: userId, UserID: userId,
} }
values := c.Request.Header.Values("content-type")
if strings.Contains(values[0], "boundary"){
record.Body = "file"
}
writer := responseBodyWriter{ writer := responseBodyWriter{
ResponseWriter: c.Writer, ResponseWriter: c.Writer,
body: &bytes.Buffer{}, body: &bytes.Buffer{},

Loading…
Cancel
Save