M-DOC-FULL P2 | EPUB read_epub_metadata 与 read_epub_chapters 重复 ZIP 解析 #98
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
epub.rs中read_epub_metadata()和read_epub_chapters()各自独立执行:fs::File::open→ 打开文件ZipArchive::new→ 解析 ZIPread_opf→ 读取 container.xml + OPFparse_opf→ 解析 manifest/spine两次调用会重复执行全部步骤。
建议
合并为单次读取:
read_epub(file_path) -> Result<EpubData, _>,返回EpubData { metadata: EpubMetadata, chapters: Vec<EpubChapter> }。代码位置
crates/zx_document_core/src/epub.rs:30-73审计来源
#71-#74 批审查发现。
修复完成
问题
read_epub_metadata()和read_epub_chapters()各自独立执行 ZIP 打开 + OPF 解析,调用两次等于重复全部步骤。修复
新增
read_epub(file_path) -> EpubData— 单次 ZIP 打开 + OPF 解析,同时返回 metadata + chapters:read_epub_metadata和read_epub_chapters现在委托到read_epub,保持向后兼容。验证