feat(core/files): SVG rendering for thumbnails

This commit is contained in:
Paul Makles
2024-10-02 12:36:56 +01:00
parent efa7ba78ed
commit a8db1cb40d
4 changed files with 289 additions and 25 deletions

View File

@@ -19,7 +19,11 @@ pub fn determine_mime_type(f: &mut NamedTempFile, buf: &[u8], file_name: &str) -
// See if the file is actually just plain Unicode/ASCII text
if mime_type == "application/octet-stream" && simdutf8::basic::from_utf8(buf).is_ok() {
return "plain/text";
if file_name.to_lowercase().ends_with(".svg") {
return "image/svg+xml";
} else {
return "plain/text";
}
}
mime_type