labstack / echo

High performance, minimalist Go web framework
https://echo.labstack.com
MIT License
29.94k stars 2.23k forks source link

`bind` : add support of multipart multi files #2684

Closed martinyonatann closed 1 month ago

martinyonatann commented 1 month ago

Summary This PR introduces support for handling multipart requests that contain multiple files in the bind function. It extends the current functionality to allow seamless parsing and binding of multiple files uploaded through multipart form data.

Changes

Testing

Additional Information This update improves the flexibility of the bind function when dealing with file uploads, making it easier to handle bulk file operations in a single request.

martinyonatann commented 1 month ago

to resolve this issue #2672

martinyonatann commented 1 month ago

any update @aldas ?

aldas commented 1 month ago

This is a good improvement. Thank you.

I took some liberties and modified your PR to my maintainer preferences https://github.com/aldas/echo/commit/8c702f423c0f802efed2f6e39b9d75ae1c1cb751

I think plain/non-pointer multipart.FileHeader should not be allowed bound to, as you can not determine easily from struct field if it was bound into or not. Field of type multipart.FileHeader struct sound more like field that MUST be bound to but Echo struct tag binding does not have concept of "must". Does this sound acceptable?

If you agree to, I would edit this PR.

martinyonatann commented 1 month ago

hi @aldas, i agree with your suggestions. Please feel free to proceed with editing the PR as you see fit.

aldas commented 1 month ago

Ok, done, Thank you @martinyonatann . I'll probably do another release in couple of days to get this released.