Skip to content

Commit

Permalink
fix: binding error while not upload file (gin-gonic#3819)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangmj committed Jan 4, 2024
1 parent 7937505 commit 3e3598d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions binding/form_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package binding
import (
"errors"
"fmt"
"mime/multipart"
"reflect"
"strconv"
"strings"
Expand Down Expand Up @@ -235,6 +236,8 @@ func setWithProperType(val string, value reflect.Value, field reflect.StructFiel
switch value.Interface().(type) {
case time.Time:
return setTimeField(val, field, value)
case multipart.FileHeader:
return nil
}
return json.Unmarshal(bytesconv.StringToBytes(val), value.Addr().Interface())
case reflect.Map:
Expand Down

0 comments on commit 3e3598d

Please sign in to comment.