diff options
| author | Benjamin Kagia <kagia@server.fake> | 2013-04-19 20:20:23 +0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-07-11 09:11:59 -0400 |
| commit | b0953dc91385fb2823294a76d3c99e01c7b7e4ee (patch) | |
| tree | 86f129ff99ca6f8276e71eb7f811fc28596badc3 /django/http | |
| parent | ecd746191c428866e621b9d13ac90a116b1369dc (diff) | |
Fixed #13721 -- Added UploadedFile.content_type_extra.
Thanks Waldemar Kornewald and mvschaik for work on the patch.
Diffstat (limited to 'django/http')
| -rw-r--r-- | django/http/multipartparser.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py index eeb435fa57..9a5193e49b 100644 --- a/django/http/multipartparser.py +++ b/django/http/multipartparser.py @@ -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 |
