diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e53f29..61a7642 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased - +### Added + - MSI detection to [`infer`] backend ## v0.3.7 - 2021-09-25 ### Added - `-j`/`--jobs` flag for specifying the number of threads fif should use for scanning files diff --git a/src/mime_db.rs b/src/mime_db.rs index fde0531..d0f91b8 100644 --- a/src/mime_db.rs +++ b/src/mime_db.rs @@ -18,8 +18,6 @@ cfg_if! { db: infer::Infer, } - // TODO: msi - fn open_document_check(buf: &[u8], kind: &str) -> bool { let mime = format!("application/vnd.oasis.opendocument.{}", kind); let mime = mime.as_bytes(); @@ -53,6 +51,10 @@ cfg_if! { buf.starts_with(b"\x46\x4f\x52\x4d\x41\x49\x46\x46") }); + info.add("application/x-msi", "msi", |buf| { + buf.starts_with(b"\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1") + }) + info.add("image/svg+xml", "svg", |buf| { // before doing the moderately expensive SVG check, we should make sure that the input is actually SGML-ish, // by which i mean, starts with anywhere from zero to ∞-1 whitespace characters, and then a less than sign,