From 2d03019c91ab8d07dfbfb1e54db86d0c4978ab9a Mon Sep 17 00:00:00 2001 From: Tony Zelenoff Date: Thu, 9 Oct 2014 17:15:12 +0400 Subject: [PATCH] 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 --- lib/private/largefilehelper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.39.5