mirror of
https://github.com/beetbox/beets.git
synced 2026-02-21 23:03:26 +01:00
web: __init__: _rep: change to base64 encoding
As suggested, this commit adds base64 encoding for the bytes encoding. Signed-off-by: Mark Stenglein <mark@stengle.in>
This commit is contained in:
parent
471d46d67e
commit
9394e0ac63
1 changed files with 2 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ from flask import g
|
|||
from werkzeug.routing import BaseConverter, PathConverter
|
||||
import os
|
||||
import json
|
||||
import base64
|
||||
|
||||
|
||||
# Utilities.
|
||||
|
|
@ -44,7 +45,7 @@ def _rep(obj, expand=False):
|
|||
|
||||
# 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')
|
||||
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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue