Skip to content

Fix multipart file uploads without content type#5072

Merged
asvetlov merged 8 commits intomasterfrom
sjaensch-fix-multipart-files-without-content-type
Oct 18, 2020
Merged

Fix multipart file uploads without content type#5072
asvetlov merged 8 commits intomasterfrom
sjaensch-fix-multipart-files-without-content-type

Conversation

@asvetlov
Copy link
Copy Markdown
Member

What do these changes do?

Multipart form data with files without a content type were not treated correctly anymore by the aiohttp server.

Are there changes in behavior for the user?

This restores the behavior as it was up to aiohttp 3.5.4; for aiohttp 3.6.0 and aiohttp 3.6.1 it would treat such file uploads as normal fields, including trying to utf8-decode the data.

Fixed conflicts of #4090

Fixes #4089.

@asvetlov asvetlov requested a review from webknjaz as a code owner October 18, 2020 11:34
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 18, 2020
@codecov-io
Copy link
Copy Markdown

codecov-io commented Oct 18, 2020

Codecov Report

Merging #5072 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5072   +/-   ##
=======================================
  Coverage   97.65%   97.65%           
=======================================
  Files          43       43           
  Lines        8981     8983    +2     
  Branches     1411     1412    +1     
=======================================
+ Hits         8770     8772    +2     
  Misses         98       98           
  Partials      113      113           
Flag Coverage Δ
#unit 97.65% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiohttp/web_request.py 97.60% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ecaf342...8ab79e3. Read the comment docs.

@asvetlov
Copy link
Copy Markdown
Member Author

Thanks, @sjaensch !

@asvetlov asvetlov merged commit 78949fd into master Oct 18, 2020
@asvetlov asvetlov deleted the sjaensch-fix-multipart-files-without-content-type branch October 18, 2020 11:55
aio-libs-github-bot bot pushed a commit that referenced this pull request Oct 18, 2020
* Fix multipart file uploads without content type

* Fix mypy issue, add comment about multipart content type header

* Fix line length issue, convert comment to docstring, do not escape line ending

* Make presence of newlines in strings explicit, change back from docstring to comment

* Fix tests

* Reformat

* Reformat

Co-authored-by: Stephan Jaensch <[email protected]>
@aio-libs-github-bot
Copy link
Copy Markdown
Contributor

💚 Backport successful

The PR was backported to the following branches:

aio-libs-github-bot bot added a commit that referenced this pull request Oct 18, 2020
Backports the following commits to 3.7:
 - Fix multipart file uploads without content type (#5072)

Co-authored-by: Andrew Svetlov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File uploads without a content type are treated as ordinary fields

4 participants