Skip to content

fix(docreader): extract designated EPUB cover images - #5476

Open
Yzzz88 wants to merge 2 commits into
Tencent:mainfrom
Yzzz88:fix/docreader-epub-designated-cover
Open

Yzzz88 wants to merge 2 commits into
Tencent:mainfrom
Yzzz88:fix/docreader-epub-designated-cover

Conversation

@Yzzz88

@Yzzz88 Yzzz88 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Description

When an EPUB chapter references the package's designated cover, EbookLib exposes that item as ITEM_COVER. DocReader now extracts it alongside ordinary image items, so the chapter's Markdown reference points to the extracted cover bytes.

Type of Change

  • Bug fix

Related Issue

Fixes #5474.

Testing

  • With the new regression and the original parser at cbdceba, image_count was 0 instead of 1.
  • With the fix, all 20 EPUB tests passed on Windows: python -B -m unittest discover -s docreader/tests -p "test_epub*.py" -v. The new test checks the image count, the original JPEG bytes, and the rewritten Markdown reference.
  • git diff --check passed. Validation was scoped to EPUB parsing.

AI assistance

OpenAI Codex reproduced the reported issue, prepared the patch, and ran the tests. Human line-by-line review has not yet been confirmed.

@Yzzz88
Yzzz88 marked this pull request as ready for review November 22, 2026 07:44
@Yzzz88

Yzzz88 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for your time on this project. Regarding this change (extract designated EPUB cover images), when you have a chance to review it, is there any additional context or validation you would like me to provide?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: EPUB import drops the designated cover image

1 participant