diff --git a/src/archive/zip.rs b/src/archive/zip.rs index c3ce44b..fa0ab18 100644 --- a/src/archive/zip.rs +++ b/src/archive/zip.rs @@ -145,7 +145,9 @@ where W: Write + Seek, { let mut writer = zip::ZipWriter::new(writer); - let options = zip::write::FileOptions::default(); + // always use ZIP64 to allow compression of files larger than 4GB + // the format is widely supported and the extra 20B is negligible in most cases + let options = zip::write::FileOptions::default().large_file(true); let output_handle = Handle::from_path(output_path); #[cfg(not(unix))] @@ -220,15 +222,9 @@ where }; 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 - .large_file(large) - .last_modified_time(get_last_modified_time(&file)), + options.last_modified_time(get_last_modified_time(&file)), )?; io::copy(&mut file, &mut writer)?; }