diff options
-rw-r--r-- | lib/private/Files/Type/Detection.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 05901a6f0b9..23f14e3c1cb 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -273,18 +273,18 @@ class Detection implements IMimeTypeDetector { // lets see if it does have mime support $path = escapeshellarg($path); $fp = popen("test -f $path && file -b --mime-type $path", 'r'); - $mimeType = fgets($fp); - pclose($fp); - - if ($mimeType !== false) { - //trim the newline - $mimeType = trim($mimeType); - $mimeType = $this->getSecureMimeType($mimeType); - if ($mimeType !== 'application/octet-stream') { + if ($fp !== false) { + $mimeType = fgets($fp); + pclose($fp); + if ($mimeType !== false) { + //trim the newline + $mimeType = trim($mimeType); + $mimeType = $this->getSecureMimeType($mimeType); return $mimeType; } } } + return 'application/octet-stream'; } |