From 829307c83b06885ba85ff1bcee47c13eb352b060 Mon Sep 17 00:00:00 2001 From: strawberry <strawberry@puppygock.gay> Date: Sun, 12 May 2024 03:18:13 -0400 Subject: [PATCH] disallow svg MIME types to be `inline` Content-Disposition Signed-off-by: strawberry <strawberry@puppygock.gay> --- src/utils/content_disposition.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/content_disposition.rs b/src/utils/content_disposition.rs index f2c1e712a..f93f6728f 100644 --- a/src/utils/content_disposition.rs +++ b/src/utils/content_disposition.rs @@ -16,7 +16,13 @@ pub(crate) fn content_disposition_type(buf: &[u8], _content_type: &Option<String }; match file_type.matcher_type() { - MatcherType::Image | MatcherType::Audio | MatcherType::Text | MatcherType::Video => "inline", + MatcherType::Image | MatcherType::Audio | MatcherType::Text | MatcherType::Video => { + if file_type.mime_type().contains("svg") { + "attachment" + } else { + "inline" + } + }, _ => "attachment", } } -- GitLab