Try more methods

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2019-12-10 10:56:47 +01:00
parent 6ad7e75708
commit 107ef72afb
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with 12 additions and 3 deletions

View File

@ -233,7 +233,10 @@ class Detection implements IMimeTypeDetector {
if ($info) {
$info = strtolower($info);
$mimeType = strpos($info, ';') !== false ? substr($info, 0, strpos($info, ';')) : $info;
return $this->getSecureMimeType($mimeType);
$mimeType = $this->getSecureMimeType($mimeType);
if ($mimeType !== 'application/octet-stream') {
return $mimeType;
}
}
}
@ -246,7 +249,10 @@ class Detection implements IMimeTypeDetector {
// use mime magic extension if available
$mimeType = mime_content_type($path);
if ($mimeType !== false) {
return $this->getSecureMimeType($mimeType);
$mimeType = $this->getSecureMimeType($mimeType);
if ($mimeType !== 'application/octet-stream') {
return $mimeType;
}
}
}
@ -261,7 +267,10 @@ class Detection implements IMimeTypeDetector {
if ($mimeType !== false) {
//trim the newline
$mimeType = trim($mimeType);
return $this->getSecureMimeType($mimeType);
$mimeType = $this->getSecureMimeType($mimeType);
if ($mimeType !== 'application/octet-stream') {
return $mimeType;
}
}
}