From 464e0f8115e3b5b01b6110ddc7a73274164c8584 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 22 Dec 2010 13:56:19 -0800 Subject: [PATCH] Don't trust text/xml mime types; generic content detection gives useless stuff like that on SVG images! Todo: replace the extension check in this case with better content-based checks. --- lib/mediafile.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mediafile.php b/lib/mediafile.php index a41d7c76b5..caa902de5d 100644 --- a/lib/mediafile.php +++ b/lib/mediafile.php @@ -362,7 +362,9 @@ class MediaFile // we'll try detecting a type from its extension... $unclearTypes = array('application/octet-stream', 'application/vnd.ms-office', - 'application/zip'); + 'application/zip', + // TODO: for XML we could do better content-based sniffing too + 'text/xml'); if ($originalFilename && (!$filetype || in_array($filetype, $unclearTypes))) { $type = $mte->getMIMEType($originalFilename);