Prevent error 500 for cover of not exisiting book

This commit is contained in:
OzzieIsaacs 2019-03-23 20:29:53 +01:00
parent 169ace777a
commit 8ab9365688

View File

@ -471,7 +471,7 @@ def unconfigured(f):
def download_required(f): def download_required(f):
@wraps(f) @wraps(f)
def inner(*args, **kwargs): def inner(*args, **kwargs):
if current_user.role_download() or current_user.role_admin(): if current_user.role_download():
return f(*args, **kwargs) return f(*args, **kwargs)
abort(403) abort(403)
@ -2065,7 +2065,10 @@ def serve_book(book_id, book_format):
@requires_basic_auth_if_no_ano @requires_basic_auth_if_no_ano
def feed_get_cover(book_id): def feed_get_cover(book_id):
book = db.session.query(db.Books).filter(db.Books.id == book_id).first() book = db.session.query(db.Books).filter(db.Books.id == book_id).first()
return helper.get_book_cover(book.path) if book:
return helper.get_book_cover(book.path)
else:
abort(404)
def render_read_books(page, are_read, as_xml=False): def render_read_books(page, are_read, as_xml=False):