improved pre-OOXML office mime detection
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
21dfe93a05
commit
383f6a30f2
2 changed files with 9 additions and 1 deletions
|
@ -10,6 +10,7 @@ Dates are given in YYYY-MM-DD format.
|
|||
- Added Text extension set
|
||||
- More test coverage
|
||||
- Fixed a very minor output bug relating to scanning symlinked directories
|
||||
- Better detection for a specific formats (pre-OOXML Office, EXE, DLL)
|
||||
|
||||
### v0.2.11 (2021-04-04)
|
||||
#### Features
|
||||
|
|
|
@ -39,7 +39,12 @@ pub fn mime_type<T: MimeDb>(db: &T, path: &Path) -> io::Result<Option<Mime>> {
|
|||
// another is ZIP - many file formats (DOCX, ODT, JAR...) are just ZIP files with particular data structures.
|
||||
// determining that a file is in one of the MS office formats in particular requires looking quite far into the
|
||||
// file.
|
||||
&& mime != &Mime::from_str("application/zip").unwrap());
|
||||
&& mime != &Mime::from_str("application/zip").unwrap()
|
||||
// doc/ppt/xls files are a subset of what's known as an "OLE2 compound document storage", at least according to
|
||||
// shared-mime-info. if a pre-OOXML era MS office file is scanned and identified as x-ole-storage, reading further
|
||||
// will allow it to be detected correctly as the appropriate filetype.
|
||||
&& mime != &Mime::from_str("application/x-ole-storage").unwrap()
|
||||
);
|
||||
|
||||
if r.is_some() {
|
||||
return Ok(r);
|
||||
|
@ -89,6 +94,8 @@ cached! {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
match exts {
|
||||
Some(exts) => {
|
||||
let possible_exts: Vec<String> = exts.iter().map(|e| String::from(*e)).collect();
|
||||
|
|
Loading…
Reference in a new issue