WeKnora icon indicating copy to clipboard operation
WeKnora copied to clipboard

[Bug]: EPUB import drops the designated cover image

Open OUAO-FRANK opened this issue 3 weeks ago • 0 comments

Affected Component

Document Reader Service

Bug Description

Importing an EPUB 3 whose chapter refers to the package's designated cover image drops that image from the parsed document. Chapter text is retained, but the Markdown keeps the original archive-relative URL and the extracted image map is empty. The downstream image pipeline has no bytes to store or process.

Steps to Reproduce

  1. Generate an EPUB 3 with EbookLib's book.set_cover("images/cover.jpg", jpeg_bytes, create_page=False).
  2. Add a chapter whose body includes <img src="images/cover.jpg" alt="Front cover"/> and place the chapter in the spine.
  3. Pass the EPUB bytes to EPUBParser(file_name="cover.epub").parse_into_text(...) with default image extraction.

Expected Behavior

The cover is present in the image map with its original bytes; the chapter refers to that extracted image and image_count is 1.

Actual Behavior

The parser returns image_count == 0 and leaves the archive-relative reference unchanged. EbookLib returns the manifest item marked cover-image as ITEM_COVER; the extraction loop accepts only ITEM_IMAGE.

WeKnora Version

cbdcebabf48c5ee2d6868b370326aa8341703f62

Deployment Method

Build from source (local DocReader parser test)

Operating System

Windows

Additional Context

The reproducer uses an in-memory EPUB and a generated JPEG. It exercises a normal HTML img reference, independently of SVG wrapper handling in #5464 or chapter counts in #5468.

OUAO-FRANK avatar Nov 13 '26 05:11 OUAO-FRANK