From 1b3feb710d59c39a044447159e7b06624b16dd6e Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Sun, 12 Oct 2014 18:40:10 +0200 Subject: [PATCH] Use `rawurlencode` since this seems to be expected by cURL Fixes https://github.com/owncloud/core/pull/11501#issuecomment-58794405 --- lib/private/largefilehelper.php | 2 +- tests/data/strängé filename (duplicate #2).txt | 4 ++++ tests/lib/largefilehelpergetfilesize.php | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 tests/data/strängé filename (duplicate #2).txt diff --git a/lib/private/largefilehelper.php b/lib/private/largefilehelper.php index d5b7946fef..33f32255f3 100644 --- a/lib/private/largefilehelper.php +++ b/lib/private/largefilehelper.php @@ -101,7 +101,7 @@ class LargeFileHelper { */ public function getFileSizeViaCurl($filename) { if (function_exists('curl_init')) { - $fencoded = urlencode($filename); + $fencoded = rawurlencode($filename); $ch = curl_init("file://$fencoded"); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); diff --git a/tests/data/strängé filename (duplicate #2).txt b/tests/data/strängé filename (duplicate #2).txt new file mode 100644 index 0000000000..b62c3fb2ff --- /dev/null +++ b/tests/data/strängé filename (duplicate #2).txt @@ -0,0 +1,4 @@ +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \ No newline at end of file diff --git a/tests/lib/largefilehelpergetfilesize.php b/tests/lib/largefilehelpergetfilesize.php index 21a0aa9a23..58571d641e 100644 --- a/tests/lib/largefilehelpergetfilesize.php +++ b/tests/lib/largefilehelpergetfilesize.php @@ -20,8 +20,8 @@ class LargeFileHelperGetFileSize extends \PHPUnit_Framework_TestCase { public function setUp() { parent::setUp(); $ds = DIRECTORY_SEPARATOR; - $this->filename = dirname(__DIR__) . "{$ds}data{$ds}data.tar.gz"; - $this->fileSize = 4195; + $this->filename = dirname(__DIR__) . "{$ds}data{$ds}strängé filename (duplicate #2).txt"; + $this->fileSize = 446; $this->helper = new \OC\LargeFileHelper; }