-
fix: check ole storage content to differentiate filetypes (#3581)
发布于
2024-08-30 19:12:46 +00:00 ### SummaryUpdates 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 thefiletypelibrary guessed and incorrect
MIME type, such as'application/vnd.ms-excel'for a.msgfile.As part of this work, the
"msg"extra was removed because the
python-oxmsgpackage is now a base dependency.Testing
Using a test
.msgfile 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下载附件