summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-10-06 15:02:47 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2015-11-12 21:05:58 +0100
commit8db22f5d50373d6a991587c8547af6d8257ee3d8 (patch)
treed30db8c576468cf00d63325ecc7a7e3a402ebb10
parent345660b4079f65832d59603f4ddd46638bd4511a (diff)
downloadnextcloud-server-8db22f5d50373d6a991587c8547af6d8257ee3d8.tar.gz
nextcloud-server-8db22f5d50373d6a991587c8547af6d8257ee3d8.zip
fix internal path when searching in storage root
(cherry picked from commit c2d76d2)
-rw-r--r--lib/private/files/node/folder.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php
index cef5ef2d5ce..59f8424c040 100644
--- a/lib/private/files/node/folder.php
+++ b/lib/private/files/node/folder.php
@@ -259,14 +259,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;