]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use `rawurlencode` since this seems to be expected by cURL
authorLukas Reschke <lukas@owncloud.com>
Sun, 12 Oct 2014 16:40:10 +0000 (18:40 +0200)
committerLukas Reschke <lukas@owncloud.com>
Tue, 14 Oct 2014 11:16:23 +0000 (13:16 +0200)
Fixes https://github.com/owncloud/core/pull/11501#issuecomment-58794405

lib/private/largefilehelper.php
tests/data/strängé filename (duplicate #2).txt [new file with mode: 0644]
tests/lib/largefilehelpergetfilesize.php

index d5b7946feff9ba1c9e9117a73be1c13e6a925220..33f32255f3b5f783c1c3400dff50edf2f0912707 100644 (file)
@@ -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 (file)
index 0000000..b62c3fb
--- /dev/null
@@ -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
index 21a0aa9a233d3387ea8c01375675671ed73ef50c..58571d641e013c0746bafe2c09bf0336a33db7e0 100644 (file)
@@ -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;
        }