Use `rawurlencode` since this seems to be expected by cURL

Fixes https://github.com/owncloud/core/pull/11501#issuecomment-58794405
remotes/origin/fix-10825
Lukas Reschke 11 years ago
parent 766314a6be
commit 1b3feb710d
  1. 2
      lib/private/largefilehelper.php
  2. 4
      tests/data/strängé filename (duplicate #2).txt
  3. 4
      tests/lib/largefilehelpergetfilesize.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);

@ -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.

@ -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;
}

Loading…
Cancel
Save