mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Archives.ArchiveFactory.Open returns a ZipArchive but ZipArchive.IsZipFile is false #593
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @njlr on GitHub (Oct 4, 2023).
Output:
This suggests a bug in
ArchiveFactory.Opento me - it shouldn't return aZipArchivefor a file whereZipArchive.IsZipFileisfalse.I cannot share the zip file, unfortunately.
@btomblinson commented on GitHub (Nov 12, 2023):
@njlr do you have any way to share the .zip in question for reproducing this?
@DannyBoyk commented on GitHub (Jan 29, 2024):
The fact it can extract any entries at all implies it has at least some zip headers in it, even if
IsZipFilereturns false. This seems too specific to the zip file to be able to debug without it. I'm afraid you'll need to step through the headers in the file manually in something like HxD. The Wikipedia Zip file format article is a good reference. You need to try to figure out where things go off track.@adamhathcock commented on GitHub (Jan 29, 2024):
IsZipFile just checks if there is a valid header. This should probably change to use the magic bytes for the format. However, it can be a valid zip without the magic bytes