mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 03:54:21 +01:00
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:
parent
84febb13c1
commit
471d46d67e
1 changed files with 4 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue