Skip to content

fix(mobile): extract covers from large epub imports#435

Open
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-mobile-large-epub-cover-import
Open

fix(mobile): extract covers from large epub imports#435
codedogQBY wants to merge 1 commit into
mainfrom
codex/fix-mobile-large-epub-cover-import

Conversation

@codedogQBY

@codedogQBY codedogQBY commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Analysis

Changes

  • Add a range-based EPUB metadata extractor that reads the ZIP EOCD/central directory from the file tail, then loads only metadata and cover entries on demand.
  • Keep the existing whole-file metadata extraction path for small EPUBs, but route large mobile EPUB imports through the range extractor instead of skipping metadata.
  • Preserve entry size caps for OPF/container text and cover image reads so large books do not get loaded wholesale.
  • Add image MIME mappings for jpg, jpeg, png, webp, and gif so mobile cover replacement opens image files correctly.

Verification

  • pnpm exec biome check packages/app-expo/src/lib/book/metadata-extractor.ts packages/app-expo/src/stores/library-store.ts packages/app-expo/src/lib/platform/expo-platform-service.ts
    • Passes with existing warnings in touched files (noExplicitAny in Expo platform service and unused saveCoverToAppData).
  • pnpm --filter @readany/app-expo exec tsc --noEmit
  • git diff --check
  • Bundled metadata-extractor.ts with esbuild and ran an ad-hoc Node verification that builds a 40 MB+ EPUB in memory; extractEpubMetadataFromFile correctly returned title, author, and cover bytes without reading through the import code path.

Fixes #412
Fixes #187

@codedogQBY codedogQBY added bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression area:ai AI, model configuration, vectorization, citations, prompts area:mobile Mobile, tablet, React Native, Android, iOS area:library Library, book management, groups, tags, metadata area:import Import, download, file handling, format support labels Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai AI, model configuration, vectorization, citations, prompts area:import Import, download, file handling, format support area:library Library, book management, groups, tags, metadata area:mobile Mobile, tablet, React Native, Android, iOS bug Something isn't working priority:p1 High: important feature broken or major platform/workflow regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

大文件(40M以上)epub文件导入出现的问题 [Bug] 导入后无法显示书籍封面图片

1 participant