2
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-18 03:25:37 +00:00

Update web.py

This commit is contained in:
_Fervor_ 2023-02-03 23:31:49 +08:00 committed by GitHub
parent cf9a7d538f
commit 3f72c3fffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1159,7 +1159,14 @@ def serve_book(book_id, book_format, anyname):
data = calibre_db.get_book_format(book_id, book_format.upper())
if not data:
return "File not in Database"
log.info('Serving book: %s', data.name)
range_header = request.headers.get('Range', None)
if not range_header:
log.info('Serving book: %s', data.name)
response = make_response(send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + book_format))
response.headers['Accept-Ranges'] = 'bytes'
return response
if config.config_use_google_drive:
try:
headers = Headers()