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:
committed by
Tim Graham
parent
ecd746191c
commit
b0953dc913
@@ -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 [
|
||||
|
||||
Reference in New Issue
Block a user