changes based on discussion on PR #1109

This commit is contained in:
Dirk Guijt 2018-02-02 00:55:51 +01:00
parent ed1c563d1f
commit 788253cbe8

View File

@ -303,13 +303,11 @@ def parse_multipart_form(body, boundary):
form_line[colon_index + 2:]) form_line[colon_index + 2:])
if form_header_field == 'content-disposition': if form_header_field == 'content-disposition':
if 'filename' in form_parameters: file_name = form_parameters.get('filename')
file_name = form_parameters['filename'] field_name = form_parameters.get('name')
field_name = form_parameters['name']
elif form_header_field == 'content-type': elif form_header_field == 'content-type':
content_type = form_header_value content_type = form_header_value
if 'charset' in form_parameters: content_charset = form_parameters.get('charset', 'utf-8')
content_charset = form_parameters['charset']
post_data = form_part[line_index:-4] post_data = form_part[line_index:-4]
if file_name: if file_name: