web: __init__: _rep: Filter all bytes for serializer

This commit fixes issue #2532 by filtering out any byte values
added by any other extensions and decoding them to strings for the
JSON serializer.

It does not remove any of the keys, instead opting to just convert
them.

Signed-off-by: Mark Stenglein <mark@stengle.in>
This commit is contained in:
Mark Stenglein 2017-05-02 23:41:31 -04:00
parent 84febb13c1
commit 471d46d67e

View file

@ -42,6 +42,10 @@ def _rep(obj, expand=False):
else:
del out['path']
# Filter all bytes attributes and convert them to strings
for key in filter(lambda key: isinstance(out[key], bytes), out):
out[key] = out[key].decode('utf-8')
# Get the size (in bytes) of the backing file. This is useful
# for the Tomahawk resolver API.
try: