Comments (9)
under the matchers folder
matchers/document.go
The func Doc(), func Xls() and func Ppt() all have the same magic numbers.
return len(buf) > 7 &&
buf[0] == 0xD0 && buf[1] == 0xCF &&
buf[2] == 0x11 && buf[3] == 0xE0 &&
buf[4] == 0xA1 && buf[5] == 0xB1 &&
buf[6] == 0x1A && buf[7] == 0xE1
Is this the reason why the MimeType is always coming up different?
from filetype.
Microsoft Office container files are zip
containers. I don't know a reliable way to detect old Office formats. If you find it, feel free to submit a PR.
from filetype.
@kumakichi It's working?
from filetype.
@mateusmaaia It should work, if you found some MS office files can not be detected correctly, please let me know
from filetype.
@mateusmaaia It should work, if you found some MS office files can not be detected correctly, please let me know
hi there, the doc
file still be detected as a ppt
file type
from filetype.
@mateusmaaia @jeremywu0127
Oh, I was wrong
#48 only add support for docx/xlsx/pptx(even not very good), leave doc/xls/ppt untouched
So, extra work is needed
from filetype.
@jeremywu0127
doc/xls/ppt check will be a little complex, we can detect they are Composite Document File V2 Document, but we don't know which one it is (doc/xls/ppt).
Maybe we can check the name of creating application, get something like: Microsoft Office Word, it's OK; but if files are created by some none ms-office applications, say:WPS, we know nothing.
So, this problem is not easy to resolve
from filetype.
Yes, I tried a few stuffs but ended validating the content-type header
if it's doc/ppy/xls, not the best solution but still works for what I need.
Anyway, thanks! @kumakichi
from filetype.
@jeremywu0127
doc/xls/ppt check will be a little complex, we can detect they are Composite Document File V2 Document, but we don't know which one it is (doc/xls/ppt).
Maybe we can check the name of creating application, get something like: Microsoft Office Word, it's OK; but if files are created by some none ms-office applications, say:WPS, we know nothing.
So, this problem is not easy to resolve
You can detect them by checking GUID of the root entry according to https://stackoverflow.com/questions/29211263/how-to-identify-doc-docx-pdf-xls-and-xlsx-based-on-file-header/48318648#48318648 , implemented in the Rust version bojand/infer#38
from filetype.
Related Issues (20)
- filetype.IsApplication isn't defined ? HOT 1
- Tar filetype doesn't match for Pre-POSIX.1-1988 tar headers HOT 1
- Add AVIF image filetype HOT 2
- m4a mime type HOT 2
- tar file not being recognized HOT 1
- fatal error: magic.h: No such file or directory
- directory not recognized HOT 1
- ASCII Text Files Starting With Letters "BM" Are Treated As BMP Image Files
- Why ppt matcher return false for a ppt file
- Add MPEG-TS video format
- docx file is recognised as zip file HOT 3
- Easy way to recognize new formats?
- Many mime types not recognized
- deb file incorrectly matching to ar HOT 1
- Cannot install package HOT 1
- password producted file file match not working
- How do I get the http streaming file type HOT 1
- run all the time with no result, if the file name is 'console'
- xlsx类型的文件解析为zip格式
- avif file detecting is not stable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filetype.