Merge pull request #354 from figsoda/large

zip: fix compression of files larger than 4GB
This commit is contained in:
João Marcos 2023-01-31 20:47:51 -03:00 committed by GitHub
commit d36c206c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -24,7 +24,9 @@ Categories Used:
- Multi-threaded compression for gzip and snappy using gzp [\#348](https://github.com/ouch-org/ouch/pull/348) ([figsoda](https://github.com/figsoda))
### Bug fixes
### Bug Fixes
- Fix decompression of zip archives with files larger than 4GB [\#354](https://github.com/ouch-org/ouch/pull/354) ([figsoda](https://github.com/figsoda))
- Fix handling of unknown extensions during decompression [\#355](https://github.com/ouch-org/ouch/pull/355) ([figsoda](https://github.com/figsoda))

View File

@ -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))]
@ -219,7 +221,7 @@ where
options
};
let mut file = fs::File::open(entry.path())?;
let mut file = fs::File::open(path)?;
writer.start_file(
path.to_str().unwrap(),
options.last_modified_time(get_last_modified_time(&file)),