mirror of
https://github.com/beetbox/beets.git
synced 2026-01-09 01:15:38 +01:00
Fix album_art() in __init__.py
flask.send_file() expects a string, g.lib.get_album() returns bytes. Added decode() to album_art(). If g.lib.get_album() gets a non-existing id, it returns None. Python would throw an error in this case. Added check to prevent this.
This commit is contained in:
parent
1254d48b72
commit
be96c1022a
1 changed files with 2 additions and 2 deletions
|
|
@ -285,8 +285,8 @@ def album_query(queries):
|
|||
@app.route('/album/<int:album_id>/art')
|
||||
def album_art(album_id):
|
||||
album = g.lib.get_album(album_id)
|
||||
if album.artpath:
|
||||
return flask.send_file(album.artpath)
|
||||
if album and album.artpath:
|
||||
return flask.send_file(album.artpath.decode())
|
||||
else:
|
||||
return flask.abort(404)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue