MicrosoftOffice365Document identifies every OOXML ZIP container as a DOCX file.
Its magic-byte signatures are ZIP local-header variants and are not specific to Word documents. Therefore, .xlsx and .pptx files are also reported as:
- extension:
docx
- MIME type:
application/vnd.openxmlformats-officedocument.wordprocessingml.document
Reproduction
using FileTypeChecker;
using var stream = File.OpenRead("workbook.xlsx");
var result = FileTypeValidator.TryGetFileType(stream);
Console.WriteLine(result.Type.Extension); // docx
Console.WriteLine(result.Type.MimeType); // application/vnd.openxmlformats-officedocument.wordprocessingml.document
The same happens for a .pptx file.
Expected behavior
- .docx should resolve to application/vnd.openxmlformats-officedocument.wordprocessingml.document
- .xlsx should resolve to application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
- .pptx should resolve to application/vnd.openxmlformats-officedocument.presentationml.presentation
Suggested direction
OOXML files are ZIP containers, so magic bytes alone cannot distinguish the subtype. The detector needs to inspect package entries:
- word/document.xml for DOCX
- xl/workbook.xml for XLSX
- ppt/presentation.xml for PPTX
Legacy Compound File Binary formats have a similar ambiguity: .doc, .xls, and .ppt share the same container signature and should not all be reported as doc.
MicrosoftOffice365Documentidentifies every OOXML ZIP container as a DOCX file.Its magic-byte signatures are ZIP local-header variants and are not specific to Word documents. Therefore,
.xlsxand.pptxfiles are also reported as:docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentReproduction