-
-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix consumer is never called when extract uncompressed 0 byte entry #190
Conversation
do { | ||
_ = try archive.extract(entry, progress: progress) { (data) in | ||
// Progress does not finished because Progress assumes totalUnitCount > 0 | ||
// XCTAssertFalse(progress.isFinished) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When extract 0byte entry, Progress#isFinished
returns false.
I don't know it is good way or not...
https://developer.apple.com/documentation/foundation/progress
IMO, It is intuitive that Progress has 1/1 progress for extracting 0byte entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good point - we currently don't handle this edge case properly.
We are using a 1/1 progress for entries of type .directory
already and could also use the same approach for zero-byte files.
Since this PR handles the bug where the completion handler is not called for zero-byte files, I removed the progress related code from the test case you provided. I think the progress mis-reporting should be handled in a dedicated PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using a 1/1 progress for entries of type .directory already and could also use the same approach for zero-byte files.
It looks good to me. thanks!
Thanks for providing this PR - good catch! I saw that you also filed a similar issue for compressed entries: #191 |
Hmm. In my memory, method is different betweeon compressed and uncompressed entry... (It's the reason I created an another issue) |
Fixes #
Changes proposed in this PR
consumer
is never called while extracting 0 byte entry from uncompressed archive.Tests performed
testExtractUncompressedEmptyFile
testExtractUncompressedEmptyFile.zip
is copy fromtestExtractUncompressedDataDescriptorArchive.zip
Further info for the reviewer
Open Issues
N/A