From fda8369f3892ea9cabdad262badcaa47605d42e8 Mon Sep 17 00:00:00 2001 From: Penny Leach Date: Tue, 16 Mar 2010 18:58:08 +0000 Subject: [PATCH] filelib MDL-21752 fixed case where mimeinfo_from_icon was including document/unknown when there were better options --- lib/filelib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/filelib.php b/lib/filelib.php index f5b987d1767..2f69f035567 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -1292,6 +1292,9 @@ function mimeinfo_from_icon($element, $icon, $all=false) { } } if ($all) { + if (count($info) > 1) { + array_shift($info); // take off document/unknown if we have better options + } return $info; } return array_pop($info); // Return last match (mimicking behaviour/comment inside foreach loop)