fix internal path when searching in storage root

This commit is contained in:
Robin Appelman 2015-10-06 15:02:47 +02:00 committed by Thomas Müller
parent e28a2ff888
commit c2d76d2010

View file

@ -215,14 +215,17 @@ class Folder extends Node implements \OCP\Files\Folder {
* @var \OC\Files\Storage\Storage $storage
*/
list($storage, $internalPath) = $this->view->resolvePath($this->path);
$internalPath = rtrim($internalPath, '/') . '/';
$internalPath = rtrim($internalPath, '/');
if ($internalPath !== '') {
$internalPath = $internalPath . '/';
}
$internalRootLength = strlen($internalPath);
$cache = $storage->getCache('');
$results = call_user_func_array(array($cache, $method), $args);
foreach ($results as $result) {
if ($internalRootLength === 1 or substr($result['path'], 0, $internalRootLength) === $internalPath) {
if ($internalRootLength === 0 or substr($result['path'], 0, $internalRootLength) === $internalPath) {
$result['internalPath'] = $result['path'];
$result['path'] = substr($result['path'], $internalRootLength);
$result['storage'] = $storage;