diff --git a/lib/Epub/Epub.cpp b/lib/Epub/Epub.cpp index ecfc8f95..4101614f 100644 --- a/lib/Epub/Epub.cpp +++ b/lib/Epub/Epub.cpp @@ -435,11 +435,8 @@ bool Epub::generateThumbBmp(int height) const { const auto coverImageHref = bookMetadataCache->coreMetadata.coverItemHref; if (coverImageHref.empty()) { Serial.printf("[%lu] [EBP] No known cover image for thumbnail\n", millis()); - return false; - } - - if (coverImageHref.substr(coverImageHref.length() - 4) == ".jpg" || - coverImageHref.substr(coverImageHref.length() - 5) == ".jpeg") { + } else if (coverImageHref.substr(coverImageHref.length() - 4) == ".jpg" || + coverImageHref.substr(coverImageHref.length() - 5) == ".jpeg") { Serial.printf("[%lu] [EBP] Generating thumb BMP from JPG cover image\n", millis()); const auto coverJpgTempPath = getCachePath() + "/.cover.jpg"; @@ -480,6 +477,10 @@ bool Epub::generateThumbBmp(int height) const { Serial.printf("[%lu] [EBP] Cover image is not a JPG, skipping thumbnail\n", millis()); } + // Write an empty bmp file to avoid generation attempts in the future + FsFile thumbBmp; + SdMan.openFileForWrite("EBP", getThumbBmpPath(height), thumbBmp); + thumbBmp.close(); return false; }