From: Tony Zelenoff Date: Thu, 9 Oct 2014 13:15:12 +0000 (+0400) Subject: Urlencode file name before passing it to cURL X-Git-Tag: v8.0.0alpha1~533^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2d03019c91ab8d07dfbfb1e54db86d0c4978ab9a;p=nextcloud-server.git Urlencode file name before passing it to cURL 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 --- diff --git a/lib/private/largefilehelper.php b/lib/private/largefilehelper.php index 2c35feefc8b..d5b7946feff 100644 --- a/lib/private/largefilehelper.php +++ b/lib/private/largefilehelper.php @@ -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);