From 50573f9d9136b1a5e8efeda86eaa54c618834bda Mon Sep 17 00:00:00 2001 From: figsoda Date: Tue, 31 Jan 2023 10:48:48 -0500 Subject: [PATCH] zip: fix compression of files larger than 4GB --- src/archive/zip.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/archive/zip.rs b/src/archive/zip.rs index 05af45d..c3ce44b 100644 --- a/src/archive/zip.rs +++ b/src/archive/zip.rs @@ -219,10 +219,16 @@ where options }; - let mut file = fs::File::open(entry.path())?; + let mut file = fs::File::open(path)?; + let large = file.metadata().map_or( + true, + |metadata| metadata.len() > 0xffffffff, // 4 GB + ); writer.start_file( path.to_str().unwrap(), - options.last_modified_time(get_last_modified_time(&file)), + options + .large_file(large) + .last_modified_time(get_last_modified_time(&file)), )?; io::copy(&mut file, &mut writer)?; }