Skip to content

Commit

Permalink
assume multipart/form-data field as text
Browse files Browse the repository at this point in the history
  • Loading branch information
hubo1016 committed Mar 23, 2017
1 parent 20ef6f5 commit 1438fc3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aiohttp/web_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ def post(self):
out.add(field.name, ff)
else:
value = yield from field.read(decode=True)
if content_type.startswith('text/'):
if content_type is None or \
content_type.startswith('text/'):
charset = field.get_charset(default='utf-8')
value = value.decode(charset)
out.add(field.name, value)
Expand Down

3 comments on commit 1438fc3

@gallifrey
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain whey line 391 is necessary? It seems that is the line that clear the variable content_type. Thanks

@fafhrd91
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we assume content_type is 'text/' by default.

@gallifrey
Copy link

@gallifrey gallifrey commented on 1438fc3 Apr 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I guess each part has its own content_type

Please sign in to comment.