From e2a46e4281920867ba37c67fddbaaa2820f067d2 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 18 Aug 2026 07:29:18 +0900 Subject: refactor(zip): return a ZipEntryStat struct from stat_index The stat array was modelled as IndexMap, forcing callers through untyped lookups with an unwrap_or(0) fallback PHP has no counterpart for. Only `size` and `comp_size` are kept: statIndex has a single call site in Composer and it reads nothing else. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/downloader/zip_downloader.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/downloader') diff --git a/crates/shirabe/src/downloader/zip_downloader.rs b/crates/shirabe/src/downloader/zip_downloader.rs index a63aca18..cdb9307c 100644 --- a/crates/shirabe/src/downloader/zip_downloader.rs +++ b/crates/shirabe/src/downloader/zip_downloader.rs @@ -309,11 +309,8 @@ impl ZipDownloader { random_int(0..total_files) }; if let Some(stat) = zip_archive.stat_index(stat_index) { - let size = stat.get("size").and_then(|v| v.as_int()).unwrap_or(0); - let comp_size = - stat.get("comp_size").and_then(|v| v.as_int()).unwrap_or(0); - total_size += size; - if !inspect_all && size > comp_size * 200 { + total_size += stat.size; + if !inspect_all && stat.size > stat.comp_size * 200 { total_size = 0; inspect_all = true; i = -1; -- cgit v1.3.1-4-g156e