zip
: find preambles for zip files written by archive/zip
#24
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.
zip files written by
archive/zip
'sWriter
correctly report the byte offsets of their central directory file header and end of central directory entries, but this means the offset of the zip data within the file as calculated byarchive/zip
'sReader
will always be 0 - in other words,Reader
thinks that any non-zip data prepended to the file is actually part of the first file's local file header. This prevents any zip file written byarchive/zip
from being used as a source for thezip
command's--preamble_from
option, because the non-zip data doesn't appear to be non-zip data at all.In cases where
Reader
identifies that the byte offset of the zip data within the file is 0, check whether the byte offset of the header for the first local file header is also 0. If it isn't, assume the byte offset of the first local file header is the true starting position of the zip data within the file, and that anything before it is in fact a preamble.