Skip to content

Commit

Permalink
Workaround for some versions/systems where finfo_open() with second
Browse files Browse the repository at this point in the history
argument doesn't do the same as with no 2nd argument as it should
  • Loading branch information
alecpl committed Mar 20, 2013
1 parent 02c9c93 commit 4f693e9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion program/lib/Roundcube/rcube_mime.php
Expand Up @@ -672,7 +672,16 @@ public static function file_content_type($path, $name, $failover = 'application/

// try fileinfo extension if available
if (!$mime_type && function_exists('finfo_open')) {
if ($finfo = finfo_open(FILEINFO_MIME, $mime_magic)) {
// null as a 2nd argument should be the same as no argument
// this however is not true on all systems/versions
if ($mime_magic) {
$finfo = finfo_open(FILEINFO_MIME, $mime_magic);
}
else {
$finfo = finfo_open(FILEINFO_MIME);
}

if ($finfo) {
if ($is_stream)
$mime_type = finfo_buffer($finfo, $path);
else
Expand Down

0 comments on commit 4f693e9

Please sign in to comment.