Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-02-07 20:42:03 +0400
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-02-07 20:46:16 +0400
commit1ef3e4c5c66b9b261952ac780bbc1cd69f5fe404 (patch)
tree47147fa756e15e1feb5cff56b04db878d146727c /lib/helper.php
parent6cff5418a75775b9cb2f8c877797b469d5cd3ce9 (diff)
simplyfy mimetype parsing of 'file' output
Diffstat (limited to 'lib/helper.php')
-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;