From 859700794abece7d5a90896a87fe012164d9fc0e Mon Sep 17 00:00:00 2001 From: A Farzat Date: Tue, 3 Mar 2026 08:38:11 +0300 Subject: Add OPF file detection We need to know its full_path as it will be referenced in container.xml. --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index 34d4d51..4f28d52 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,6 +109,12 @@ async fn main() -> Result<()> { let spine_items: Vec = fetch_all_pages(&client, epub_data.spine.clone()).await?; let toc_vec: Vec = fetch_direct_array(&client, &epub_data.table_of_contents).await?; + // Find the OPF file entry to reference it in container.xml + let opf_entry = file_entries + .iter() + .find(|f| f.filename_ext == ".opf" && f.media_type == "application/oebps-package+xml") + .context("No OPF file with the correct MIME type was found.")?; + // Sanity check: Every entry in spine exists in chapters. let chapters: HashMap = chapters.into_iter().map(|c| (c.ourn.clone(), c)).collect(); -- cgit v1.2.3-70-g09d2