From: Robin Date: Wed, 12 May 2010 00:02:58 +0000 (+0200) Subject: imporovement in mimetype detection X-Git-Tag: v3.0~395 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=645de2ff787d035f4c8a7423961f37c7f0c325f4;p=nextcloud-server.git imporovement in mimetype detection --- diff --git a/inc/lib_filestorage.php b/inc/lib_filestorage.php index c3161b25d39..3c34cc21102 100644 --- a/inc/lib_filestorage.php +++ b/inc/lib_filestorage.php @@ -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);