diff --git a/src/Mime-Detective/Extensions/FileInfo/ArchiveExtensions.cs b/src/Mime-Detective/Extensions/FileInfo/ArchiveExtensions.cs
index e66ddc9..736a599 100644
--- a/src/Mime-Detective/Extensions/FileInfo/ArchiveExtensions.cs
+++ b/src/Mime-Detective/Extensions/FileInfo/ArchiveExtensions.cs
@@ -14,7 +14,7 @@ public static partial class FileInfoExtensions
///
/// true if the specified file info is zip; otherwise, false.
///
- public static bool IsZip(this FileInfo fileInfo) => fileInfo.IsType(MimeTypes.ZIP);
+ public static bool IsZip(this FileInfo fileInfo) => fileInfo.IsType(MimeTypes.ZIP) || fileInfo.IsType(MimeTypes.ZIP_EMPTY);
///
/// Determines whether the specified file is RAR-archive.
diff --git a/src/Mime-Detective/MimeTypes.cs b/src/Mime-Detective/MimeTypes.cs
index 317f140..b012754 100644
--- a/src/Mime-Detective/MimeTypes.cs
+++ b/src/Mime-Detective/MimeTypes.cs
@@ -152,6 +152,7 @@ public static class MimeTypes
public readonly static FileType ZIP_7z = new FileType(new byte?[] { 0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C }, "7z", "application/x-compressed");
public readonly static FileType ZIP = new FileType(new byte?[] { 0x50, 0x4B, 0x03, 0x04 }, "zip", "application/x-compressed");
+ public readonly static FileType ZIP_EMPTY = new FileType(new byte?[] { 0x50, 0x4B, 0x05, 0x06 }, "zip", "application/x-compressed");
public readonly static FileType RAR = new FileType(new byte?[] { 0x52, 0x61, 0x72, 0x21 }, "rar", "application/x-compressed");
public readonly static FileType DLL_EXE = new FileType(new byte?[] { 0x4D, 0x5A }, "dll,exe", "application/octet-stream");
@@ -212,7 +213,7 @@ EML is also used by Outlook Express and QuickMail.
//EVTX Windows Vista event log file
public readonly static FileType ELF = new FileType(new byte?[] { 0x45, 0x6C, 0x66, 0x46, 0x69, 0x6C, 0x65, 0x00 }, "elf", "text/plain");
- public static readonly FileType[] Types = new FileType[] { PDF, JPEG, ZIP, RAR, RTF, PNG, GIF, DLL_EXE, MS_OFFICE,
+ public static readonly FileType[] Types = new FileType[] { PDF, JPEG, ZIP, ZIP_EMPTY, RAR, RTF, PNG, GIF, DLL_EXE, MS_OFFICE,
BMP, DLL_EXE, ZIP_7z, GZ_TGZ, TAR_ZH, TAR_ZV, OGG, ICO, XML, DWG, LIB_COFF, PST, PSD, BZ2,
AES, SKR, SKR_2, PKR, EML_FROM, ELF, TXT_UTF8, TXT_UTF16_BE, TXT_UTF16_LE, TXT_UTF32_BE, TXT_UTF32_LE,
Mp3ID3, Wav, Flac, MIDI,
diff --git a/test/Mime-Detective.Tests/Data/Zip/EmptiedBy7zip.zip b/test/Mime-Detective.Tests/Data/Zip/EmptiedBy7zip.zip
new file mode 100644
index 0000000..15cb0ec
Binary files /dev/null and b/test/Mime-Detective.Tests/Data/Zip/EmptiedBy7zip.zip differ
diff --git a/test/Mime-Detective.Tests/Data/Zip/emptyZip.zip b/test/Mime-Detective.Tests/Data/Zip/emptyZip.zip
new file mode 100644
index 0000000..15cb0ec
Binary files /dev/null and b/test/Mime-Detective.Tests/Data/Zip/emptyZip.zip differ
diff --git a/test/Mime-Detective.Tests/Tests/Analyzers/ZipFileAnalyzerTestsTests.cs b/test/Mime-Detective.Tests/Tests/Analyzers/ZipFileAnalyzerTestsTests.cs
index 2027d1a..92e8dba 100644
--- a/test/Mime-Detective.Tests/Tests/Analyzers/ZipFileAnalyzerTestsTests.cs
+++ b/test/Mime-Detective.Tests/Tests/Analyzers/ZipFileAnalyzerTestsTests.cs
@@ -27,6 +27,8 @@ public void DefaultConstructor()
[InlineData("./Data/Documents/DocxWord2016.docx", "docx")]
[InlineData("./Data/Zip/Images.zip", "zip")]
[InlineData("./Data/Zip/ImagesBy7zip.zip", "zip")]
+ [InlineData("./Data/Zip/EmptiedBy7zip.zip", "zip")]
+ [InlineData("./Data/Zip/emptyZip.zip", "zip")]
public async Task Search(string path, string ext)
{
var analyzer = new ZipFileAnalyzer();
diff --git a/test/Mime-Detective.Tests/Tests/Zip/CommonFormats.cs b/test/Mime-Detective.Tests/Tests/Zip/CommonFormats.cs
index a4640ec..6a6690e 100644
--- a/test/Mime-Detective.Tests/Tests/Zip/CommonFormats.cs
+++ b/test/Mime-Detective.Tests/Tests/Zip/CommonFormats.cs
@@ -24,6 +24,18 @@ public async Task IsZip(string file)
await AssertIsType(fileInfo, MimeTypes.ZIP);
}
+ [Theory]
+ [InlineData("emptyZip")]
+ [InlineData("EmptiedBy7zip")]
+ public async Task IsEmptyZip(string file)
+ {
+ var fileInfo = GetFileInfo(dataPath, file, ".zip");
+
+ Assert.True(fileInfo.IsZip());
+
+ await AssertIsType(fileInfo, MimeTypes.ZIP_EMPTY);
+ }
+
[Fact]
public async Task Is7zip()
{