fix: validate OPF cover items as images (#2062)
This commit is contained in:
+3
-2
@@ -104,8 +104,9 @@ bool Epub::parseContentOpf(BookMetadataCache::BookMetadata& bookMetadata) {
|
||||
const auto endPos = coverPageHtml.find('"', pos);
|
||||
if (endPos != std::string::npos) {
|
||||
const auto ref = std::string_view{coverPageHtml}.substr(pos, endPos - pos);
|
||||
// Check if it's an image file
|
||||
if (FsHelpers::hasPngExtension(ref) || FsHelpers::hasJpgExtension(ref) || FsHelpers::hasGifExtension(ref)) {
|
||||
// Cover BMP generation supports JPG/PNG only; skip GIF so an unsupported wrapper image
|
||||
// does not block a later supported cover reference.
|
||||
if (FsHelpers::hasPngExtension(ref) || FsHelpers::hasJpgExtension(ref)) {
|
||||
imageRef = ref;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user