fix: we should be checking for xml
MIME type instead
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
829307c83b
commit
4185a33747
1 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
use infer::MatcherType;
|
use infer::MatcherType;
|
||||||
|
|
||||||
|
use crate::debug_info;
|
||||||
|
|
||||||
/// Returns a Content-Disposition of `attachment` or `inline`, depending on the
|
/// Returns a Content-Disposition of `attachment` or `inline`, depending on the
|
||||||
/// *parsed* contents of the file uploaded via format magic keys using `infer`
|
/// *parsed* contents of the file uploaded via format magic keys using `infer`
|
||||||
/// crate (basically libmagic without needing libmagic).
|
/// crate (basically libmagic without needing libmagic).
|
||||||
|
@ -15,9 +17,11 @@ pub(crate) fn content_disposition_type(buf: &[u8], _content_type: &Option<String
|
||||||
return "attachment";
|
return "attachment";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
debug_info!("MIME type: {}", file_type.mime_type());
|
||||||
|
|
||||||
match file_type.matcher_type() {
|
match file_type.matcher_type() {
|
||||||
MatcherType::Image | MatcherType::Audio | MatcherType::Text | MatcherType::Video => {
|
MatcherType::Image | MatcherType::Audio | MatcherType::Text | MatcherType::Video => {
|
||||||
if file_type.mime_type().contains("svg") {
|
if file_type.mime_type().contains("xml") {
|
||||||
"attachment"
|
"attachment"
|
||||||
} else {
|
} else {
|
||||||
"inline"
|
"inline"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue