From e3014de2cef2b9fc546dc708bb14dd7f52088bcb Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 6 May 2019 13:30:09 +0200 Subject: [PATCH] Simplify code around detected mimetype string --- program/lib/Roundcube/rcube_mime.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/program/lib/Roundcube/rcube_mime.php b/program/lib/Roundcube/rcube_mime.php index f1db70acd..199af9b13 100644 --- a/program/lib/Roundcube/rcube_mime.php +++ b/program/lib/Roundcube/rcube_mime.php @@ -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; }