5 Commits

Author SHA1 Message Date
adityajai119
fc07a2296b fix(binding): leave file fields unset for an empty multipart file part
Browsers send a file input with no file selected as a part with
filename="" and an empty body. mime/multipart stores that part as a
form value, so multipartRequest.TrySet found no files and fell back to
setByForm, which bound a non-nil empty multipart.FileHeader to pointer
fields and one empty entry to slices and arrays. binding:"required"
then passed although no file was uploaded.

Leave file-typed fields unset when the request has no files for the
key, so an empty file part binds like a missing one.

Fixes #2376
2026-11-12 17:45:14 +05:30
thinkerou
4b68a5f12a
chore: update go.mod and remove space from copyright (#3158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-28 10:42:28 +08:00
axiaoxin
1a2bc0e7cb
setted typo fix: There’s no such word as setted, set is set, set, setting (#2886) 2021-09-30 10:04:28 +08:00
heige
97a32b1de3
Optimize code adjust (#2700)
* setFormMap error of result

* adjust code for TrySet

* error export for type multipart.FileHeader

* code style adjust

* reflect code maping optimize

* Update form_mapping.go

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-06-02 07:35:30 +08:00
Dmitry Kutakov
09a3650c97 binding: add support of multipart multi files (#1878) (#1949)
* binding: add support of multipart multi files (#1878)

* update readme: add multipart file binding
2019-06-18 19:49:10 +08:00