]> source.dussan.org Git - nextcloud-server.git/commitdiff
imporovement in mimetype detection
authorRobin <robin@Amaya.(none)>
Wed, 12 May 2010 00:02:58 +0000 (02:02 +0200)
committerRobin <robin@Amaya.(none)>
Wed, 12 May 2010 00:02:58 +0000 (02:02 +0200)
inc/lib_filestorage.php

index c3161b25d394af6485ec267724249c169b5ecca6..3c34cc2110249ab20d13960d61203d11ea0bb313 100644 (file)
@@ -197,6 +197,11 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
                if (@is_dir($this->datadir.$fspath)) {
                        // directories are easy
                        return "httpd/unix-directory"; 
+               }elseif (function_exists('finfo_open') and function_exists('finfo_file') and $finfo=finfo_open(FILEINFO_MIME)){
+                       $mimeType =strtolower(finfo_file($finfo,$this->datadir.$fspath));
+                       $mimeType=substr($mimeType,0,strpos($mimeType,';'));
+                       finfo_close($finfo);
+                       return $mimeType;
                } else if (function_exists("mime_content_type")) {
                        // use mime magic extension if available
                        $mime_type = mime_content_type($this->datadir.$fspath);