filelib MDL-21752 fixed case where mimeinfo_from_icon was including document/unknown when there were better options

This commit is contained in:
Penny Leach 2010-03-16 18:58:08 +00:00
parent e1e613d52c
commit fda8369f38

View File

@ -1292,6 +1292,9 @@ function mimeinfo_from_icon($element, $icon, $all=false) {
} }
} }
if ($all) { if ($all) {
if (count($info) > 1) {
array_shift($info); // take off document/unknown if we have better options
}
return $info; return $info;
} }
return array_pop($info); // Return last match (mimicking behaviour/comment inside foreach loop) return array_pop($info); // Return last match (mimicking behaviour/comment inside foreach loop)