Fix handling of value when multiple files in form-data

It appears that the value list extracted from the `FormData`
is not necessarily composed of `UploadFile` instances.
This commit is contained in:
Viicos 2023-04-12 13:53:18 +02:00
parent 6ce6c8954c
commit 167fed622c
1 changed files with 4 additions and 1 deletions

View File

@ -778,7 +778,10 @@ async def request_body_to_args(
async with anyio.create_task_group() as tg:
for sub_value in value:
tg.start_soon(process_fn, sub_value.read)
if isinstance(sub_value, UploadFile):
tg.start_soon(process_fn, sub_value.read)
else:
results.append(sub_value)
value = sequence_shape_to_type[field.shape](results)
v_, errors_ = field.validate(value, values, loc=loc)