TonyValenti / Mime-Detective-clarkis117

Mime type detector for files, byte arrays, and streams, .NET Standard Fork
MIT License
38 stars 9 forks source link

Empty ZIP files not recognized #23

Open sandrock opened 6 years ago

sandrock commented 6 years ago

Empty ZIP files are a special kind of ZIP. The header differs.

File contents: 50 4b 05 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Calling GetFileType(this byte[] bytes) returns null.

$ file -i ZIPempty.zip
ZIPempty.zip: application/zip; charset=binary
sandrock commented 6 years ago

A ZIP header should start with 0x04034b50 but mine starts with 0x06054b50.

.ZIP File Format Specification at section "4.3.16 End of central directory record" says that my header looks like a "end of central dir signature".

Steps to recreate this file:

Do you think this makes a corrupted zip? Or is it legit?