Regression since v0.69.0: Order of the submitted form data is not always preserved #14811
-
First Check
Commit to Help
Example Code// See DescriptionDescriptionWhen submitting multiple form data with the same name, I expect the order to be always preserved when invoking the handler. Consider the following request: # To reliably reproduce the issue, pass a big file first and a small file second
curl https://localhost:8080/process -F image=@big_image.png -F image=@small_image.pngI expect both handlers to preserve the order of the submitted files: # Always works correctly
async def handle_process(images: list[UploadFile]) -> ProcessingImagesResult:
# 'images' list may be in the wrong order
async def handle_process(images: t.Annotated[t.List[bytes], File()]) -> ProcessingImagesResult:Root cause is the following change done in PR #3372 released in v0.69.0 (see my comment there):
As you can see, the data order is no longer preserved after this change. Corresponding place in the latest release (v0.128.0): fastapi/fastapi/dependencies/utils.py Line 897 in 8322a44 Operating SystemLinux, Windows, macOS Operating System DetailsOS version does not matter FastAPI Version0.115.14 Pydantic Version2.12.5 Python Version3.12.3 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hey. I've created PR to fix this: #14828 |
Beta Was this translation helpful? Give feedback.

Hey. I've created PR to fix this: #14828