Skip to content

Treat empty uploads as None when File(allow_none=True) - #418

Open
gyanu2507 wants to merge 1 commit into
marshmallow-code:devfrom
gyanu2507:file-allow-none
Open

Treat empty uploads as None when File(allow_none=True)#418
gyanu2507 wants to merge 1 commit into
marshmallow-code:devfrom
gyanu2507:file-allow-none

Conversation

@gyanu2507

Copy link
Copy Markdown

File(allow_none=True) already accepted None through marshmallow, but empty multipart uploads still failed: "" became missing, "null" was invalid, and a FileStorage with no filename was treated as a real file.

Those empty values now deserialize to None when allow_none=True. Existing required-field behavior is unchanged.

Fixes #319.

Empty strings, JSON null, and FileStorage without a filename were rejected even though allow_none was set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File(allow_none=True) is not possible

1 participant