diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-10-29 17:47:33 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-10-29 17:47:33 +0100 |
commit | e1e4c7c21445d28986c23adf74e67c1c75960ef7 (patch) | |
tree | 995aec58f32843cf4f4e6d3813d5babbb8978250 /lib/private/files | |
parent | 0d7d396d8013d77027d50a6c54350690416d344c (diff) | |
parent | e08f38f99babcd16701583e789838ccd9376401a (diff) | |
download | nextcloud-server-e1e4c7c21445d28986c23adf74e67c1c75960ef7.tar.gz nextcloud-server-e1e4c7c21445d28986c23adf74e67c1c75960ef7.zip |
Merge branch 'master' into fix_file_cache_updater_master
Diffstat (limited to 'lib/private/files')
-rw-r--r-- | lib/private/files/cache/cache.php | 4 | ||||
-rw-r--r-- | lib/private/files/type/detection.php | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index fc2d965d7f9..c1e5b34c8aa 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -64,6 +64,10 @@ class Cache { * @return int */ public function getMimetypeId($mime) { + if (empty($mime)) { + // Can not insert empty string into Oracle NOT NULL column. + $mime = 'application/octet-stream'; + } if (empty(self::$mimetypeIds)) { $this->loadMimetypes(); } diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php index 242a81cb5a4..d7cc9ebbf4e 100644 --- a/lib/private/files/type/detection.php +++ b/lib/private/files/type/detection.php @@ -61,8 +61,6 @@ class Detection { * @return string */ public function detect($path) { - $isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://'); - if (@is_dir($path)) { // directories are easy return "httpd/unix-directory"; @@ -76,9 +74,11 @@ class Detection { $info = @strtolower(finfo_file($finfo, $path)); if ($info) { $mimeType = substr($info, 0, strpos($info, ';')); + return empty($mimeType) ? 'application/octet-stream' : $mimeType; } finfo_close($finfo); } + $isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://'); if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) { // use mime magic extension if available $mimeType = mime_content_type($path); @@ -94,6 +94,10 @@ class Detection { //trim the newline $mimeType = trim($reply); + if (empty($mimeType)) { + $mimeType = 'application/octet-stream'; + } + } return $mimeType; } |