Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +2008,7 @@ fn write_data_descriptor<T: Write>(writer: &mut T, file: &ZipFileData) -> ZipRes
block.write(writer)?;
} else {
// check compressed size as well as it can also be slightly larger than uncompressed size
if file.compressed_size > spec::ZIP64_BYTES_THR {
if file.compressed_size > spec::ZIP64_BYTES_THR && !file.large_file {
return Err(ZipError::Io(io::Error::other(
"Large file option has not been set",
)));
Comment on lines +2011 to 2014
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This else block is only entered if file.data_descriptor_block() returns None, which, based on its implementation, only happens when file.large_file is true. Consequently, the added condition !file.large_file will always evaluate to false, making this entire if statement and its body unreachable.

For better code clarity, it would be best to remove the now-unreachable if block entirely (lines 2011-2015).

Expand Down