Simplify code around detected mimetype string

pull/6748/head
Aleksander Machniak 6 years ago
parent 3f351697c3
commit e3014de2ce

@ -742,9 +742,9 @@ class rcube_mime
if ($finfo) {
if ($is_stream)
$mime_type = finfo_buffer($finfo, $path);
$mime_type = finfo_buffer($finfo, $path, FILEINFO_MIME_TYPE);
else
$mime_type = finfo_file($finfo, $path);
$mime_type = finfo_file($finfo, $path, FILEINFO_MIME_TYPE);
finfo_close($finfo);
}
}
@ -758,11 +758,6 @@ class rcube_mime
if (!$mime_type) {
$mime_type = $failover;
}
else {
// Sometimes (PHP-5.3?) content-type contains charset definition,
// Remove it (#1487122) also "charset=binary" is useless
$mime_type = array_shift(preg_split('/[; ]/', $mime_type));
}
return $mime_type;
}

Loading…
Cancel
Save