1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #13721 -- Added UploadedFile.content_type_extra.

Thanks Waldemar Kornewald and mvschaik for work on the patch.
This commit is contained in:
Benjamin Kagia
2013-04-19 20:20:23 +03:00
committed by Tim Graham
parent ecd746191c
commit b0953dc913
9 changed files with 109 additions and 24 deletions

View File

@@ -50,7 +50,7 @@ class MultiPartParser(object):
The raw post data, as a file-like object.
:upload_handlers:
A list of UploadHandler instances that perform operations on the uploaded
data.
data.
:encoding:
The encoding with which to treat the incoming data.
"""
@@ -177,11 +177,9 @@ class MultiPartParser(object):
file_name = force_text(file_name, encoding, errors='replace')
file_name = self.IE_sanitize(unescape_entities(file_name))
content_type = meta_data.get('content-type', ('',))[0].strip()
try:
charset = meta_data.get('content-type', (0, {}))[1].get('charset', None)
except:
charset = None
content_type, content_type_extra = meta_data.get('content-type', ('', {}))
content_type = content_type.strip()
charset = content_type_extra.get('charset')
try:
content_length = int(meta_data.get('content-length')[0])
@@ -194,7 +192,7 @@ class MultiPartParser(object):
try:
handler.new_file(field_name, file_name,
content_type, content_length,
charset)
charset, content_type_extra)
except StopFutureHandlers:
break