]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed escaping of filename when determining MIME type
authorJernej Virag <jernej.virag@gmail.com>
Wed, 25 Apr 2012 08:33:52 +0000 (10:33 +0200)
committerJernej Virag <jernej.virag@gmail.com>
Wed, 25 Apr 2012 08:33:52 +0000 (10:33 +0200)
lib/helper.php

index 82d1017debdd944592c003eb1925b8e336d95c38..2ddd5e7b7787dd5cbe78fb12212863a961652802 100644 (file)
@@ -341,8 +341,8 @@ class OC_Helper {
                if (!$isWrapped and $mimeType=='application/octet-stream' && OC_Helper::canExecute("file")) {
                        // it looks like we have a 'file' command,
                        // lets see it it does have mime support
-                       $path=str_replace("'","\'",$path);
-                       $fp = popen("file -i -b '$path' 2>/dev/null", "r");
+                       $path=escapeshellarg($path);
+                       $fp = popen("file -i -b $path 2>/dev/null", "r");
                        $reply = fgets($fp);
                        pclose($fp);