mirror of
https://github.com/beetbox/beets.git
synced 2025-12-16 05:34:47 +01:00
Merge pull request #2542 from ocelotsloth/2532-web-serializer-bytes
web: #2532 - Decode bytes values to strings
This commit is contained in:
commit
908b8dca97
1 changed files with 6 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ from flask import g
|
|||
from werkzeug.routing import BaseConverter, PathConverter
|
||||
import os
|
||||
import json
|
||||
import base64
|
||||
|
||||
|
||||
# Utilities.
|
||||
|
|
@ -42,6 +43,11 @@ def _rep(obj, expand=False):
|
|||
else:
|
||||
del out['path']
|
||||
|
||||
# Filter all bytes attributes and convert them to strings
|
||||
for key, value in out.items():
|
||||
if isinstance(out[key], bytes):
|
||||
out[key] = base64.b64encode(out[key]).decode('ascii')
|
||||
|
||||
# Get the size (in bytes) of the backing file. This is useful
|
||||
# for the Tomahawk resolver API.
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue