]> source.dussan.org Git - nextcloud-server.git/commitdiff
Urlencode file name before passing it to cURL
authorTony Zelenoff <antonz@parallels.com>
Thu, 9 Oct 2014 13:15:12 +0000 (17:15 +0400)
committerTony Zelenoff <antonz@parallels.com>
Thu, 9 Oct 2014 13:15:12 +0000 (17:15 +0400)
Large file helper use cURL to determine file sizes. Thus filenames must be
urlencoded in case special symbols like '#' can cause BadRequest errors.

Signed-off-by: Tony Zelenoff <antonz@parallels.com>
lib/private/largefilehelper.php

index 2c35feefc8bfec25cead173d1a2071c6393acaa7..d5b7946feff9ba1c9e9117a73be1c13e6a925220 100644 (file)
@@ -101,7 +101,8 @@ class LargeFileHelper {
        */
        public function getFileSizeViaCurl($filename) {
                if (function_exists('curl_init')) {
-                       $ch = curl_init("file://$filename");
+                       $fencoded = urlencode($filename);
+                       $ch = curl_init("file://$fencoded");
                        curl_setopt($ch, CURLOPT_NOBODY, true);
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                        curl_setopt($ch, CURLOPT_HEADER, true);