[Pkg-owncloud-commits] [owncloud] 06/66: Fix mimetype detection
David Prévot
taffit at moszumanska.debian.org
Fri Apr 18 22:49:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v5.0.15
in repository owncloud.
commit ae4d10668e2b4c9ca953e3681bd18a3c86093481
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date: Fri Jan 17 15:05:43 2014 +0100
Fix mimetype detection
---
lib/files/cache/cache.php | 4 ++++
lib/helper.php | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index 32cad6b..a2a7a99 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -91,6 +91,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 (!isset($this->mimetypeIds[$mime])) {
$result = \OC_DB::executeAudited(
'SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = ?',
diff --git a/lib/helper.php b/lib/helper.php
index 71b3bd5..2d22f24 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -390,7 +390,6 @@ class OC_Helper {
* does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead
*/
static function getMimeType($path) {
- $isWrapped=(strpos($path, '://')!==false) and (substr($path, 0, 7)=='file://');
if (@is_dir($path)) {
// directories are easy
@@ -414,9 +413,11 @@ class OC_Helper {
$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);
@@ -432,6 +433,11 @@ class OC_Helper {
//trim the newline
$mimeType = trim($reply);
+ if (empty($mimeType)) {
+ $mimeType = 'application/octet-stream';
+ }
+
+
}
return $mimeType;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list