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:
parent
9130aceb5a
commit
f4412ee96b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user