Revert "Properly quote file names in listFiles query for GDrive"

This commit is contained in:
Lukas Reschke 2015-03-31 15:12:35 +02:00
parent b216b3fad0
commit 53f67fc65d
2 changed files with 18 additions and 20 deletions

View File

@ -113,7 +113,7 @@ class Google extends \OC\Files\Storage\Common {
if (isset($this->driveFiles[$path])) { if (isset($this->driveFiles[$path])) {
$parentId = $this->driveFiles[$path]->getId(); $parentId = $this->driveFiles[$path]->getId();
} else { } else {
$q = "title='" . rawurlencode($name) . "' and '" . rawurlencode($parentId) . "' in parents and trashed = false"; $q = "title='".$name."' and '".$parentId."' in parents and trashed = false";
$result = $this->service->files->listFiles(array('q' => $q))->getItems(); $result = $this->service->files->listFiles(array('q' => $q))->getItems();
if (!empty($result)) { if (!empty($result)) {
// Google Drive allows files with the same name, ownCloud doesn't // Google Drive allows files with the same name, ownCloud doesn't
@ -257,7 +257,7 @@ class Google extends \OC\Files\Storage\Common {
if ($pageToken !== true) { if ($pageToken !== true) {
$params['pageToken'] = $pageToken; $params['pageToken'] = $pageToken;
} }
$params['q'] = "'" . rawurlencode($folder->getId()) . "' in parents and trashed = false"; $params['q'] = "'".$folder->getId()."' in parents and trashed = false";
$children = $this->service->files->listFiles($params); $children = $this->service->files->listFiles($params);
foreach ($children->getItems() as $child) { foreach ($children->getItems() as $child) {
$name = $child->getTitle(); $name = $child->getTitle();

View File

@ -104,14 +104,13 @@ abstract class Storage extends \Test\TestCase {
} }
public function directoryProvider() { public function directoryProvider() {
return [ return array(
['folder'], array('folder'),
[' folder'], array(' folder'),
['folder '], array('folder '),
['folder with space'], array('folder with space'),
['spéciäl földer'], array('spéciäl földer'),
['test single\'quote'], );
];
} }
function loremFileProvider() { function loremFileProvider() {
@ -164,16 +163,15 @@ abstract class Storage extends \Test\TestCase {
public function copyAndMoveProvider() { public function copyAndMoveProvider() {
return [ return array(
['/source.txt', '/target.txt'], array('/source.txt', '/target.txt'),
['/source.txt', '/target with space.txt'], array('/source.txt', '/target with space.txt'),
['/source with space.txt', '/target.txt'], array('/source with space.txt', '/target.txt'),
['/source with space.txt', '/target with space.txt'], array('/source with space.txt', '/target with space.txt'),
['/source.txt', '/tärgét.txt'], array('/source.txt', '/tärgét.txt'),
['/sòurcē.txt', '/target.txt'], array('/sòurcē.txt', '/target.txt'),
['/sòurcē.txt', '/tärgét.txt'], array('/sòurcē.txt', '/tärgét.txt'),
['/single \' quote.txt', '/tar\'get.txt'], );
];
} }
public function initSourceAndTarget ($source, $target = null) { public function initSourceAndTarget ($source, $target = null) {