summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoricewind1991 <icewind1991@gmail.com>2013-02-07 14:47:10 -0800
committericewind1991 <icewind1991@gmail.com>2013-02-07 14:47:10 -0800
commit3bd33b69a1c37cee5c3d180ec8952a611aabb4d1 (patch)
tree5bbc5c351b1e385079ed0eb2d7ea3a23e61c6780
parent217328e0e3656f0068b3e41ebc4cdc32b79f3fe4 (diff)
parent1ef3e4c5c66b9b261952ac780bbc1cd69f5fe404 (diff)
downloadnextcloud-server-3bd33b69a1c37cee5c3d180ec8952a611aabb4d1.tar.gz
nextcloud-server-3bd33b69a1c37cee5c3d180ec8952a611aabb4d1.zip
Merge pull request #1527 from owncloud/simplyfy_file_mimetype_parsing
simplyfy mimetype parsing of 'file' output
-rw-r--r--lib/helper.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 0e549d006a1..a0fbdd10394 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -394,13 +394,12 @@ class OC_Helper {
// it looks like we have a 'file' command,
// lets see if it does have mime support
$path=escapeshellarg($path);
- $fp = popen("file -i -b $path 2>/dev/null", "r");
+ $fp = popen("file -b --mime-type $path 2>/dev/null", "r");
$reply = fgets($fp);
pclose($fp);
- // we have smth like 'text/x-c++; charset=us-ascii\n'
- // and need to eliminate everything starting with semicolon including trailing LF
- $mimeType = preg_replace('/;.*/ms', '', trim($reply));
+ //trim the newline
+ $mimeType = trim($reply);
}
return $mimeType;