diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-03-22 15:57:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-22 15:57:15 +0100 |
commit | 874f134f3a0b490323833f10d9153939e3ccf193 (patch) | |
tree | fcb7332458b0c02e49481e40608aa716fd9b2564 | |
parent | 8c6b6b1f0d061272133ba5d2d44b055a12580d5b (diff) | |
parent | af31fa82e8aeebabbc3df364f11b0c702c0a068f (diff) | |
download | nextcloud-server-874f134f3a0b490323833f10d9153939e3ccf193.tar.gz nextcloud-server-874f134f3a0b490323833f10d9153939e3ccf193.zip |
Merge pull request #8891 from nextcloud/fix_8890
Fix proper permissions for multiple file access
-rw-r--r-- | lib/private/Files/Node/Folder.php | 21 | ||||
-rw-r--r-- | tests/lib/Files/Node/FolderTest.php | 2 |
2 files changed, 11 insertions, 12 deletions
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index fcadbe27393..95ceeee3698 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -302,18 +302,15 @@ class Folder extends Node implements \OCP\Files\Folder { return []; } - // we only need to get the cache info once, since all mounts we found point to the same storage - - $mount = $folderMounts[$mountsContainingFile[0]->getMountPoint()]; - $cacheEntry = $mount->getStorage()->getCache()->get((int)$id); - if (!$cacheEntry) { - return []; - } - // cache jails will hide the "true" internal path - $internalPath = ltrim($mountsContainingFile[0]->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/'); - - $nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($cacheEntry, $folderMounts, $internalPath) { + $nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) { $mount = $folderMounts[$cachedMountInfo->getMountPoint()]; + $cacheEntry = $mount->getStorage()->getCache()->get((int)$id); + if (!$cacheEntry) { + return null; + } + + // cache jails will hide the "true" internal path + $internalPath = ltrim($cachedMountInfo->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/'); $pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath())); $pathRelativeToMount = ltrim($pathRelativeToMount, '/'); $absolutePath = $cachedMountInfo->getMountPoint() . $pathRelativeToMount; @@ -323,6 +320,8 @@ class Folder extends Node implements \OCP\Files\Folder { )); }, $mountsContainingFile); + $nodes = array_filter($nodes); + return array_filter($nodes, function (Node $node) { return $this->getRelativePath($node->getPath()); }); diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php index 6479dad58d3..c924c090232 100644 --- a/tests/lib/Files/Node/FolderTest.php +++ b/tests/lib/Files/Node/FolderTest.php @@ -682,7 +682,7 @@ class FolderTest extends NodeTest { $fileInfo = new CacheEntry(['path' => 'foo/qwerty', 'mimetype' => 'text/plain'], null); - $storage->expects($this->once()) + $storage->expects($this->exactly(2)) ->method('getCache') ->will($this->returnValue($cache)); |