Skip to content

Conversation

@Its-Just-Nans
Copy link
Contributor

Hello

I think #467 was not great

It's hiding a potential error which is not a good idea

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Its-Just-Nans, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of the ZIP writing functionality by addressing a potential silent failure when handling files larger than the standard ZIP format's 4GB limit. It introduces clearer error reporting for such cases and provides an optional mechanism for automatic detection and application of ZIP64 data descriptors, improving both safety and developer experience.

Highlights

  • Improved Error Handling for Large Files: The system now explicitly checks if a file exceeds the standard ZIP size limit (ZIP64_BYTES_THR) when writing its data descriptor. If large_file(true) is not set, an io::ErrorKind::Other error is returned, preventing silent data corruption or unexpected behavior for files larger than 4GB.
  • Automatic ZIP64 Data Descriptor: A new set_auto_large_file() method has been added to ZipWriter, allowing users to opt-in to automatically use ZIP64 data descriptors when a file's compressed size exceeds the standard limit, without needing to explicitly set large_file(true) for each file.
  • Refactored Test Case: The existing test for write_data_descriptor in src/spec.rs has been updated to reflect and validate the new error handling and automatic ZIP64 behavior, ensuring the changes work as intended.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request improves error handling for large files by introducing an auto_large_file option for streaming writers. Instead of silently truncating file sizes, it now either automatically promotes to ZIP64 format if the option is enabled, or returns an error. This is a great improvement in robustness.

I've added a couple of comments:

  • A high-severity issue in write_data_descriptor where the check for large files is incomplete and could lead to data corruption.
  • A medium-severity suggestion to improve naming conventions for a newly introduced field to align better with Rust API guidelines.

Its-Just-Nans and others added 4 commits October 31, 2025 01:13
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: n4n5 <git@n4n5.dev>
@Pr0methean Pr0methean changed the title better write_data_descriptor #467 fix: Return an error when a file is unexpectedly large (#467) Nov 19, 2025
@Pr0methean Pr0methean changed the title fix: Return an error when a file is unexpectedly large (#467) feat: ZipWriter set_auto_large_file() method to enable large-file data descriptor when necessary Nov 19, 2025
@Pr0methean Pr0methean added this pull request to the merge queue Nov 19, 2025
Merged via the queue into zip-rs:master with commit 69533f1 Nov 20, 2025
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants