diff --git a/Cargo.lock b/Cargo.lock index c3be9fc..8de2fe0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,15 +107,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "arbitrary" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" -dependencies = [ - "derive_arbitrary", -] - [[package]] name = "arrayvec" version = "0.7.8" @@ -203,6 +194,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + [[package]] name = "chrono" version = "0.4.44" @@ -350,12 +347,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - [[package]] name = "crossterm" version = "0.29.0" @@ -453,17 +444,6 @@ dependencies = [ "powerfmt", ] -[[package]] -name = "derive_arbitrary" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "difflib" version = "0.4.0" @@ -581,6 +561,7 @@ checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", "miniz_oxide", + "zlib-rs", ] [[package]] @@ -987,9 +968,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.182" +version = "0.2.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" +checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" [[package]] name = "libredox" @@ -1066,6 +1047,18 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "nom" version = "7.1.3" @@ -1820,6 +1813,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "typed-path" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e" + [[package]] name = "typenum" version = "1.19.0" @@ -2364,21 +2363,25 @@ dependencies = [ [[package]] name = "zip" -version = "2.4.2" +version = "9.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabe6324e908f85a1c52063ce7aa26b68dcb7eb6dbc83a2d148403c9bc3eba50" +checksum = "a954114b47a54df49f83d2722814e86b23d4bb1b54a1b90fb7d92b41619ddc22" dependencies = [ - "arbitrary", "crc32fast", - "crossbeam-utils", - "displaydoc", "flate2", "indexmap", "memchr", - "thiserror 2.0.18", + "nix", + "typed-path", "zopfli", ] +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + [[package]] name = "zmij" version = "1.0.21" diff --git a/Cargo.toml b/Cargo.toml index 59b3c94..ff3f403 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,4 +20,4 @@ chrono = { version = "0.4", features = ["serde"] } ureq = { version = "3", features = ["json", "cookies"] } rusqlite = { version = "0.32", features = ["bundled-full"] } sha2 = "0.10" -zip = { version = "2", default-features = false, features = ["deflate"] } +zip = { version = "9", default-features = false, features = ["deflate"] } diff --git a/crates/idx-core/src/ownership/archive.rs b/crates/idx-core/src/ownership/archive.rs index f883c47..d042308 100644 --- a/crates/idx-core/src/ownership/archive.rs +++ b/crates/idx-core/src/ownership/archive.rs @@ -172,7 +172,10 @@ fn extract_txt_from_zip(path: &Path) -> Result { continue; } - let name = file.name().to_ascii_lowercase(); + // An undecodable entry name cannot be the TXT payload. + let Ok(name) = file.name().map(|name| name.to_ascii_lowercase()) else { + continue; + }; if !name.ends_with(".txt") { continue; } diff --git a/crates/idx-core/src/ownership/xlsx.rs b/crates/idx-core/src/ownership/xlsx.rs index c8650d9..58751f8 100644 --- a/crates/idx-core/src/ownership/xlsx.rs +++ b/crates/idx-core/src/ownership/xlsx.rs @@ -87,11 +87,13 @@ fn read_zip_entry( } fn first_worksheet_name(zip: &mut zip::ZipArchive>) -> Result { + // Undecodable entry names cannot be worksheets; skip them. let mut sheets: Vec = zip .file_names() + .filter_map(Result::ok) .filter(|name| name.starts_with("xl/worksheets/") && name.ends_with(".xml")) .filter(|name| !name["xl/worksheets/".len()..].contains('/')) - .map(str::to_string) + .map(|name| name.into_owned()) .collect(); // sheet1.xml, sheet2.xml, ... sort by their numeric suffix. sheets.sort_by_key(|name| {