mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-07 22:03:17 +03:00
Fix broken 'binary content' in browseable API
This commit is contained in:
parent
d4721fc1f7
commit
4631b91e14
|
@ -332,8 +332,8 @@ class BrowsableAPIRenderer(BaseRenderer):
|
||||||
renderer_context['indent'] = 4
|
renderer_context['indent'] = 4
|
||||||
content = renderer.render(data, accepted_media_type, renderer_context)
|
content = renderer.render(data, accepted_media_type, renderer_context)
|
||||||
|
|
||||||
if not isinstance(content, six.text_type):
|
if not all(char in string.printable for char in content):
|
||||||
return '[%d bytes of binary content]'
|
return '[%d bytes of binary content]' % len(content)
|
||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user