diff options
author | Joas Schilling <coding@schilljs.com> | 2019-12-10 10:56:47 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-12-10 10:56:47 +0100 |
commit | 107ef72afba5f7d59614637736764ad1c092ff96 (patch) | |
tree | 844e84a8cfd7f6811aae88fa5037c9ab05452e34 /lib/private/Files | |
parent | 6ad7e75708d646915e34b9ebe00d3a541f2d507e (diff) | |
download | nextcloud-server-107ef72afba5f7d59614637736764ad1c092ff96.tar.gz nextcloud-server-107ef72afba5f7d59614637736764ad1c092ff96.zip |
Try more methods
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Files')
-rw-r--r-- | lib/private/Files/Type/Detection.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index d1193b7a36b..cebbccd6ad6 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -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; + } } } |