Skip to content

Commit b9b6f0a

Browse files
committed
fix a bug
1 parent 73ea3bc commit b9b6f0a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

binder.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package ship
1717
import (
1818
"encoding/json"
1919
"encoding/xml"
20+
"mime/multipart"
2021
"net/http"
2122
"net/url"
2223
"strings"
@@ -129,7 +130,12 @@ func FormBinder(maxMemory int64, tag ...string) Binder {
129130
return err
130131
}
131132

132-
return binder.BindURLValuesAndFiles(v, r.Form, r.MultipartForm.File, _tag)
133+
var fhs map[string][]*multipart.FileHeader
134+
if r.MultipartForm != nil {
135+
fhs = r.MultipartForm.File
136+
}
137+
138+
return binder.BindURLValuesAndFiles(v, r.Form, fhs, _tag)
133139
})
134140
}
135141

0 commit comments

Comments
 (0)