From d253804a50fd6bb8d8348d61f65a2cd9c50747a7 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Wed, 16 Aug 2023 18:04:45 +0200 Subject: [PATCH] fix for #2865 (Kobo sync fails during cover request) --- cps/kobo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cps/kobo.py b/cps/kobo.py index c8fecd1c..1655fb5e 100644 --- a/cps/kobo.py +++ b/cps/kobo.py @@ -930,7 +930,11 @@ def get_current_bookmark_response(current_bookmark): @kobo.route("//////image.jpg") @requires_kobo_auth def HandleCoverImageRequest(book_uuid, width, height, Quality, isGreyscale): - resolution = None if height > 1000 else COVER_THUMBNAIL_SMALL + try: + resolution = None if int(height) > 1000 else COVER_THUMBNAIL_SMALL + except ValueError: + log.error("Requested height %s of book %s is invalid" % (book_uuid, height)) + resolution = COVER_THUMBNAIL_SMALL book_cover = helper.get_book_cover_with_uuid(book_uuid, resolution=resolution) if book_cover: log.debug("Serving local cover image of book %s" % book_uuid)