Skip Zip64 extra fields when strict input doesn't require it.#127
Merged
mrkkrp merged 3 commits intomrkkrp:masterfrom May 25, 2025
Merged
Skip Zip64 extra fields when strict input doesn't require it.#127mrkkrp merged 3 commits intomrkkrp:masterfrom
mrkkrp merged 3 commits intomrkkrp:masterfrom
Conversation
Owner
|
Great stuff! Thanks for simplifying the code and fixing my silly typos :) Could you please do the following:
|
mrkkrp
reviewed
May 24, 2025
Use foldlWithKey, foldMapWithKey, and traverseWithKey to process Maps in a single pass and avoid using (!), which is a partial function.
The case statement in question evaluates to an identical expression in all cases, so we can elide it.
3a3fda9 to
2480edf
Compare
Contributor
Author
|
Okay, all three points should be addressed now :) I also adjusted the |
When entry data is provided as a strict ByteString, we don't need to stream the data to determine its uncompressed size. Thus, we can rule out the need for Zip64 extra fields early. This addresses issue mrkkrp#126.
mrkkrp
approved these changes
May 25, 2025
Owner
|
Thanks! I will release a new version (2.2.0) on Hackage later today. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #126.
When entry data is provided as a strict
ByteString, we don't need to stream any data to determine its uncompressed size. Thus, we can rule out the need for Zip64 extra fields early when writing the local header. This applies mainly toaddEntry, which takes its input as a strictByteString.In summary, I added a new
PendingActioncalledStrictEntryand a newEntryOrigin(StrictOrigin Int) which tracks the size of strict data for use when building the header. I decided to pass that toputHeaderas part of theLocalHeaderHeaderTypebecause the information is only really relevant when writing the local header (nothing is different for the CD headers).I also made some additional minor code simplifications that don't change any behavior. Some Maps were being iterated over many times because of a combination of
forM_and(!)fromData.Map.Strict. My change reduces those to a single pass where possible while avoiding(!), which is no longer recommended.All the tests are passing for me.