发布

  • fix: check ole storage content to differentiate filetypes (#3581)

    frostbyte_neo 发布于 2024-08-30 19:12:46 +00:00

      ### Summary
    

    Updates the file detection logic for OLE files to check the storage
    content of the file to more reliable differentiate between DOC, PPT, XLS
    and MSG files. This corrects a bug that caused file type detection to be
    incorrect in cases where the filetype library guessed and incorrect
    MIME type, such as 'application/vnd.ms-excel' for a .msg file.

    As part of this work, the "msg" extra was removed because the
    python-oxmsg package is now a base dependency.

    Testing

    Using a test .msg file that returns 'application/vnd.ms-excel' from
    filetype.guess_mime.

    from unstructured.file_utils.filetype import detect_filetype
    
    filename = "test-file.msg"
    detect_filetype(filename=filename) # result should be FileType.MSG
    
    下载附件