marshmallow-code / flask-marshmallow

Flask + marshmallow for beautiful APIs
http://flask-marshmallow.readthedocs.io/
MIT License
875 stars 59 forks source link

Fix File field when it receives an empty value #301

Closed uncle-lv closed 8 months ago

uncle-lv commented 8 months ago

When we don't select a file, swagger send an empty value like this:

POST http://localhost:5000/images HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------70636434840698183742419445910

-----------------------------70636434840698183742419445910
Content-Disposition: form-data; name="image"

-----------------------------70636434840698183742419445910--

Then the value of File field(named image above) is an empty string, and a ValidationError("Not a valid file.") occurs. But in fact it's missing.

uncle-lv commented 8 months ago

This bug is found here.

sloria commented 8 months ago

thanks for fixing these! I'll merge and release these File field fixes when i get some time today

raulblanxart commented 8 months ago

Hi, thanks for the fast fix of this issue. I'm triying to check the fix, but now the error comes when add a file, i had the same 422 error

thanks.

uncle-lv commented 8 months ago

Hi, thanks for the fast fix of this issue. I'm triying to check the fix, but i can't use the new code, whuen I install apiflask i think that not dowload the new version.

When will be available the new version?

thanks.

A new version of apiflask hasn't been released. And I don't have permission to do it. @greyli usually releases new versions on weekends.

For this bug, you can just upgrade your flask-marshmallow after it's new version is released.

raulblanxart commented 8 months ago

Yes sorry, was mi mistake, I didn't read the error, the plobelms comes for the file extension.

Yes now all it's working fine.

Thans!