fix: ignore zip info extra field on failure#868
Conversation
There was a problem hiding this comment.
The PR correctly implements the fix for issue #867 by changing Unicode extra field handling to gracefully ignore invalid CRC32 values instead of throwing errors. This aligns with the ZIP specification (APPNOTE 4.6.8 and 4.6.9) which states that if the CRC check fails, the UTF-8 extra field SHOULD be ignored and the File Name field in the header SHOULD be used instead.
The implementation properly:
- Validates CRC32 before applying Unicode fields
- Falls back to original fields when validation fails
- Adds comprehensive test coverage for both Unicode path and comment scenarios
The changes are minimal and focused on the specific issue, maintaining backward compatibility while improving robustness.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
There was a problem hiding this comment.
Code Review
This pull request introduces CRC32 validation for Unicode extra fields (path and comment) in ZIP archives, ensuring that UTF-8 fields are ignored if their CRC32 does not match the ASCII fields. It also adds corresponding tests. The review feedback suggests simplifying the CRC32 validation logic to return the comparison directly, and using into_vec() instead of to_vec() to avoid unnecessary heap allocations when updating the file comment and name. Additionally, a defensive UTF-8 validity check is recommended for the filename byte string.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
fix #867