Skip to content
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

Allow archive recovery with central directory header is missing or damaged #104

Open
abbeycode opened this issue Feb 25, 2020 · 0 comments

Comments

@abbeycode
Copy link
Owner

abbeycode commented Feb 25, 2020

When an archive's central directory header is corrupted (see this file for an example), you can still search through the archive for local file headers, which is a lot slower than using the central directory header.

  • Add a new -validateArchive method that returns whether the archive metadata is good or has problems
  • Add a new swift RecoveredArchive class (exposed as UZKRecoveredArchive to Objective-C) that can be instantiated to read archives with damaged central headers (whose documentation would note it won't be as fast as regular archive reading), with these limited capabilities:
    • The constructor fails if it can't find the first local file header, which should start at the beginning of the file
    • Exporting a reconstructed archive with available file headers
    • Listing available file info
    • Iterating through the recoverable file data
    • Iterating through the recoverable file data with a buffer

The RecoveredArchive class would build its own file info mapping on initialization to make further operations faster. File data would still be returned with UZKFileInfo, if possible. If not, create a new RecoveredFileInfo class. Use MiniZip where it makes sense, but do everything outside MiniZip that's necessary. The ZIP spec will be essential to this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant