From 9a0113d1dc6c67f1d903c12970e76d46ac81a39d Mon Sep 17 00:00:00 2001 From: Lynne Date: Mon, 22 Feb 2021 02:32:38 +1000 Subject: [PATCH] quick hack to work around non-existent document support ;3 --- src/inspectors.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/inspectors.rs b/src/inspectors.rs index bd59a59..98a93ce 100644 --- a/src/inspectors.rs +++ b/src/inspectors.rs @@ -2,6 +2,7 @@ use std::fs::File; use std::io; use std::io::{Read, Seek, SeekFrom}; use std::path::Path; +use std::str::FromStr; use cached::cached; use mime_guess::Mime; @@ -85,6 +86,19 @@ cached! { // to have valid extensions. [vec![String::from("xml"), String::from("svg")], possible_exts].concat() + } else if mime == Mime::from_str("application/zip").unwrap() { + // until proper document support is added, treat all common document extensions as zips + [vec![ + String::from("zip"), + String::from("docx"), + String::from("pptx"), + String::from("xlsx"), + String::from("odt"), + String::from("ods"), + String::from("odp"), + String::from("pages"), + String::from("key"), + String::from("numbers")], possible_exts].concat() } else { possible_exts })