From 71769490fb8449d8b5d7d82de1ef0e669ff98f8a Mon Sep 17 00:00:00 2001 From: Justin Mitchell Date: Sun, 8 Feb 2026 15:49:49 -0500 Subject: [PATCH] fix: Add EPUB 3 cover image detection (#760) I had an epub that just showed a blank cover and wouldnt work for the sleep screen either, turns out it was an epub3 and I guess we didn't support that. Super simple fix here --- lib/Epub/Epub/parsers/ContentOpfParser.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Epub/Epub/parsers/ContentOpfParser.cpp b/lib/Epub/Epub/parsers/ContentOpfParser.cpp index ae7e61a5..6ae37d14 100644 --- a/lib/Epub/Epub/parsers/ContentOpfParser.cpp +++ b/lib/Epub/Epub/parsers/ContentOpfParser.cpp @@ -232,6 +232,14 @@ void XMLCALL ContentOpfParser::startElement(void* userData, const XML_Char* name Serial.printf("[%lu] [COF] Found EPUB 3 nav document: %s\n", millis(), href.c_str()); } } + + // EPUB 3: Check for cover image (properties contains "cover-image") + if (!properties.empty() && self->coverItemHref.empty()) { + if (properties == "cover-image" || properties.find("cover-image ") == 0 || + properties.find(" cover-image") != std::string::npos) { + self->coverItemHref = href; + } + } return; }