fix: we should be checking for xml MIME type instead

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-05-12 12:42:34 -04:00 committed by June
parent 829307c83b
commit 4185a33747

View file

@ -1,5 +1,7 @@
use infer::MatcherType;
use crate::debug_info;
/// Returns a Content-Disposition of `attachment` or `inline`, depending on the
/// *parsed* contents of the file uploaded via format magic keys using `infer`
/// crate (basically libmagic without needing libmagic).
@ -15,9 +17,11 @@ pub(crate) fn content_disposition_type(buf: &[u8], _content_type: &Option<String
return "attachment";
};
debug_info!("MIME type: {}", file_type.mime_type());
match file_type.matcher_type() {
MatcherType::Image | MatcherType::Audio | MatcherType::Text | MatcherType::Video => {
if file_type.mime_type().contains("svg") {
if file_type.mime_type().contains("xml") {
"attachment"
} else {
"inline"