]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix detection of non extention types
authorRoeland Jago Douma <roeland@famdouma.nl>
Thu, 12 Dec 2019 08:58:22 +0000 (09:58 +0100)
committerBackportbot <backportbot-noreply@rullzer.com>
Thu, 12 Dec 2019 22:06:09 +0000 (22:06 +0000)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
lib/private/Files/Type/Detection.php

index 2801bfadd17b46c7a2f38a2634ed57ca8496db46..ebd28e7cd24c387f64bef61c3945f6eab0b11740 100644 (file)
@@ -181,8 +181,11 @@ class Detection implements IMimeTypeDetector {
                        $fileName = preg_replace('!((\.v\d+)|((\.ocTransferId\d+)?\.part))$!', '', $fileName);
 
                        //try to guess the type by the file extension
-                       $extension = strtolower(strrchr($fileName, '.'));
-                       $extension = substr($extension, 1); //remove leading .
+                       $extension = strrchr($fileName, '.');
+                       if ($extension !== false) {
+                               $extension = strtolower($extension);
+                               $extension = substr($extension, 1); //remove leading .
+                       }
                        return (isset($this->mimetypes[$extension]) && isset($this->mimetypes[$extension][0]))
                                ? $this->mimetypes[$extension][0]
                                : 'application/octet-stream';