fields: force base64 data as bytes (#36515)

This commit is contained in:
Frédéric Péters 2019-11-15 20:02:42 +01:00
parent 129306e47d
commit 6c89239f3d
1 changed files with 1 additions and 1 deletions

View File

@ -1000,7 +1000,7 @@ class FileField(WidgetField):
# b64_content key and a filename keys and an optional
# content_type key.
if 'b64_content' in value:
value['content'] = base64.decodestring(value['b64_content'])
value['content'] = base64.decodestring(force_bytes(value['b64_content']))
if 'filename' in value and 'content' in value:
content_type = value.get('content_type') or 'application/octet-stream'
if content_type.startswith('text/'):