Skip to content

File uploads without a content type are treated as ordinary fields #4089

Closed
@sjaensch

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

  1. 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.
  2. 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.

Metadata

Assignees

No one assigned

    Labels

    pr-rejectedregressionSomething that used to work stopped working "as before" after upgradeserver

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions