Skip to content

OOXML spreadsheets and presentations are detected as DOCX #58

Description

@Vladipz

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions