]> source.dussan.org Git - nextcloud-server.git/commitdiff
Try more methods
authorJoas Schilling <coding@schilljs.com>
Tue, 10 Dec 2019 09:56:47 +0000 (10:56 +0100)
committerBackportbot <backportbot-noreply@rullzer.com>
Thu, 12 Dec 2019 22:06:08 +0000 (22:06 +0000)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Files/Type/Detection.php

index ce7a6f669ca3907242bb91329ff7a6e14d5a1ce5..2801bfadd17b46c7a2f38a2634ed57ca8496db46 100644 (file)
@@ -213,7 +213,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;
+                               }
                        }
                }
 
@@ -226,7 +229,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;
+                               }
                        }
                }
 
@@ -241,7 +247,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;
+                               }
                        }
 
                }