-
-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle single file in cases of multiple file uploads (#2950)
* fix: correctly parse files when uploading list of files When a model is specified for uploading files and a specific field in that model is annotated with `list[UploadFile]` and a single file is uploaded, the validation fails. This is because the extracted file is not passed onto `msgspec` as a list. This fixes that by ensuring that the value is converted into a list if needed before giving it to `msgspec` for validation. * fix: handle case where name may not be in the form data If there was no field name with the expected name (as per the given model), we don't want to raise a KeyError there. Instead the missing field name should be raised as a validation error by the validation library. * refactor: use API provided by FieldDefinition
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters