File uploads without a content type are treated as ordinary fields #4089
Closed
Description
Long story short
Multipart file uploads do not work correctly since aiohttp 3.6.0 unless a content type is provided. This used to work up to aiohttp 3.5.4 and broke due to #3905, this line specifically.
Expected behaviour
File upload data is treated as a binary data stream if no content type is provided.
Actual behaviour
File upload data is treated as an ordinary text field, possibly causing an UnicodeDecodeError.
Steps to reproduce
- Send a request to an aiohttp server with a multipart/form-data payload, where one item is a file without a content type. The requests library will not provide a content type unless you specifically set one.
- Call
await request.post()in your aiohttp server.
Your environment
This issue is causing integration tests for bravado-asyncio to fail - the build before this one passed, the only change is the upgrade from aiohttp 3.5.4 to aiohttp 3.6.0.