1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-24 18:47:23 +00:00

Fix #1753 (errorhandling on route serve_book)

This commit is contained in:
Ozzieisaacs 2020-12-12 06:41:12 +01:00
parent 9130aceb5a
commit f4412ee96b

View File

@ -1479,7 +1479,9 @@ def get_robots():
def serve_book(book_id, book_format, anyname):
book_format = book_format.split(".")[0]
book = calibre_db.get_book(book_id)
data = calibre_db.get_book_format(book.id, book_format.upper())
data = calibre_db.get_book_format(book_id, book_format.upper())
if not data:
abort(404)
log.info('Serving book: %s', data.name)
if config.config_use_google_drive:
headers = Headers()
@ -1490,6 +1492,7 @@ def serve_book(book_id, book_format, anyname):
return send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format)
@web.route("/download/<int:book_id>/<book_format>", defaults={'anyname': 'None'})
@web.route("/download/<int:book_id>/<book_format>/<anyname>")
@login_required_if_no_ano