Commit 25879b51 authored by Hugh Davenport's avatar Hugh Davenport Committed by Gerrit Code Review
Browse files

Merge "file_mime_type: increase use of hardcoded magic file (bug #809216)"

parents 05378095 c43ef45d
......@@ -326,8 +326,11 @@ function file_mime_type($file) {
// if /usr/share/misc/magic is a directory then finfo still succeeds and
// doesn't fall back onto the .mcg magic_file
// force /usr/share/misc/magic.mgc instead in this case
$magicfile = !is_file('/usr/share/misc/magic') ? '/usr/share/misc/magic.mgc' : null;
$MAGICPATH = '/usr/share/misc/magic';
$magicfile = null;
if (is_dir($MAGICPATH) or is_link($MAGICPATH)) {
$magicfile = '/usr/share/misc/magic.mgc';
}
if (defined('FILEINFO_MIME_TYPE')) {
if ($finfo = @new finfo(FILEINFO_MIME_TYPE, $magicfile)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment