mirror of
https://github.com/janeczku/calibre-web
synced 2026-10-19 22:32:27 +00:00
Fix crash when User-Agent header is missing
The download_link endpoint called .lower() on the User-Agent header value without providing a default, causing AttributeError when the header is absent. This matches the safe pattern already used in render_template.py
This commit is contained in:
+2
-2
@@ -1247,9 +1247,9 @@ def serve_book(book_id, book_format, anyname):
|
||||
@login_required_if_no_ano
|
||||
@download_required
|
||||
def download_link(book_id, book_format, anyname):
|
||||
if "kindle" in request.headers.get('User-Agent').lower():
|
||||
if "kindle" in request.headers.get('User-Agent', "").lower():
|
||||
client = "kindle"
|
||||
elif "Kobo" in request.headers.get('User-Agent').lower():
|
||||
elif "Kobo" in request.headers.get('User-Agent', "").lower():
|
||||
client = "kobo"
|
||||
else:
|
||||
client = ""
|
||||
|
||||
Reference in New Issue
Block a user