diff --git a/cps/web.py b/cps/web.py index f41c3e0d..1d37ce50 100644 --- a/cps/web.py +++ b/cps/web.py @@ -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//", defaults={'anyname': 'None'}) @web.route("/download///") @login_required_if_no_ano