1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +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

@@ -180,7 +180,11 @@ def encode_multipart(boundary, data):
def encode_file(boundary, key, file):
to_bytes = lambda s: force_bytes(s, settings.DEFAULT_CHARSET)
content_type = mimetypes.guess_type(file.name)[0]
if hasattr(file, 'content_type'):
content_type = file.content_type
else:
content_type = mimetypes.guess_type(file.name)[0]
if content_type is None:
content_type = 'application/octet-stream'
return [