diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-18 07:29:18 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-18 07:29:18 +0900 |
| commit | e2a46e4281920867ba37c67fddbaaa2820f067d2 (patch) | |
| tree | b472872b46f8182aef1350493209f2d0176de185 /crates/shirabe | |
| parent | 6a7e64d04a8b0ad932169df43e2d93efe8ceedf8 (diff) | |
| download | php-shirabe-e2a46e4281920867ba37c67fddbaaa2820f067d2.tar.gz php-shirabe-e2a46e4281920867ba37c67fddbaaa2820f067d2.tar.zst php-shirabe-e2a46e4281920867ba37c67fddbaaa2820f067d2.zip | |
refactor(zip): return a ZipEntryStat struct from stat_index
The stat array was modelled as IndexMap<String, PhpMixed>, 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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe')
| -rw-r--r-- | crates/shirabe/src/downloader/zip_downloader.rs | 7 |
1 files changed, 2 insertions, 5 deletions
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; |
