Merge pull request #16502 from nextcloud/bugfix/16474
Check the if we can actually access the storage cache for recent files
This commit is contained in:
commit
e21f440990
|
@ -442,8 +442,13 @@ class Folder extends Node implements \OCP\Files\Folder {
|
||||||
}, $result));
|
}, $result));
|
||||||
|
|
||||||
return array_values(array_filter($files, function (Node $node) {
|
return array_values(array_filter($files, function (Node $node) {
|
||||||
|
$cacheEntry = $node->getMountPoint()->getStorage()->getCache()->get($node->getId());
|
||||||
|
if (!$cacheEntry) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$relative = $this->getRelativePath($node->getPath());
|
$relative = $this->getRelativePath($node->getPath());
|
||||||
return $relative !== null && $relative !== '/';
|
return $relative !== null && $relative !== '/'
|
||||||
|
&& ($cacheEntry->getPermissions() & \OCP\Constants::PERMISSION_READ) === \OCP\Constants::PERMISSION_READ;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -810,13 +810,15 @@ class FolderTest extends NodeTest {
|
||||||
'storage_mtime' => $baseTime,
|
'storage_mtime' => $baseTime,
|
||||||
'mtime' => $baseTime,
|
'mtime' => $baseTime,
|
||||||
'mimetype' => 'text/plain',
|
'mimetype' => 'text/plain',
|
||||||
'size' => 3
|
'size' => 3,
|
||||||
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
]);
|
]);
|
||||||
$id2 = $cache->put('bar/foo/old.txt', [
|
$id2 = $cache->put('bar/foo/old.txt', [
|
||||||
'storage_mtime' => $baseTime - 100,
|
'storage_mtime' => $baseTime - 100,
|
||||||
'mtime' => $baseTime - 100,
|
'mtime' => $baseTime - 100,
|
||||||
'mimetype' => 'text/plain',
|
'mimetype' => 'text/plain',
|
||||||
'size' => 3
|
'size' => 3,
|
||||||
|
'permissions' => \OCP\Constants::PERMISSION_READ
|
||||||
]);
|
]);
|
||||||
$cache->put('bar/asd/outside.txt', [
|
$cache->put('bar/asd/outside.txt', [
|
||||||
'storage_mtime' => $baseTime,
|
'storage_mtime' => $baseTime,
|
||||||
|
@ -828,7 +830,8 @@ class FolderTest extends NodeTest {
|
||||||
'storage_mtime' => $baseTime - 600,
|
'storage_mtime' => $baseTime - 600,
|
||||||
'mtime' => $baseTime - 600,
|
'mtime' => $baseTime - 600,
|
||||||
'mimetype' => 'text/plain',
|
'mimetype' => 'text/plain',
|
||||||
'size' => 3
|
'size' => 3,
|
||||||
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$node = new \OC\Files\Node\Folder($root, $view, $folderPath, $folderInfo);
|
$node = new \OC\Files\Node\Folder($root, $view, $folderPath, $folderInfo);
|
||||||
|
@ -871,21 +874,24 @@ class FolderTest extends NodeTest {
|
||||||
'storage_mtime' => $baseTime,
|
'storage_mtime' => $baseTime,
|
||||||
'mtime' => $baseTime,
|
'mtime' => $baseTime,
|
||||||
'mimetype' => \OCP\Files\FileInfo::MIMETYPE_FOLDER,
|
'mimetype' => \OCP\Files\FileInfo::MIMETYPE_FOLDER,
|
||||||
'size' => 3
|
'size' => 3,
|
||||||
|
'permissions' => 0
|
||||||
]);
|
]);
|
||||||
$id2 = $cache->put('bar/foo/folder/bar.txt', [
|
$id2 = $cache->put('bar/foo/folder/bar.txt', [
|
||||||
'storage_mtime' => $baseTime,
|
'storage_mtime' => $baseTime,
|
||||||
'mtime' => $baseTime,
|
'mtime' => $baseTime,
|
||||||
'mimetype' => 'text/plain',
|
'mimetype' => 'text/plain',
|
||||||
'size' => 3,
|
'size' => 3,
|
||||||
'parent' => $id1
|
'parent' => $id1,
|
||||||
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
]);
|
]);
|
||||||
$id3 = $cache->put('bar/foo/folder/asd.txt', [
|
$id3 = $cache->put('bar/foo/folder/asd.txt', [
|
||||||
'storage_mtime' => $baseTime - 100,
|
'storage_mtime' => $baseTime - 100,
|
||||||
'mtime' => $baseTime - 100,
|
'mtime' => $baseTime - 100,
|
||||||
'mimetype' => 'text/plain',
|
'mimetype' => 'text/plain',
|
||||||
'size' => 3,
|
'size' => 3,
|
||||||
'parent' => $id1
|
'parent' => $id1,
|
||||||
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$node = new \OC\Files\Node\Folder($root, $view, $folderPath, $folderInfo);
|
$node = new \OC\Files\Node\Folder($root, $view, $folderPath, $folderInfo);
|
||||||
|
@ -934,7 +940,8 @@ class FolderTest extends NodeTest {
|
||||||
'storage_mtime' => $baseTime,
|
'storage_mtime' => $baseTime,
|
||||||
'mtime' => $baseTime,
|
'mtime' => $baseTime,
|
||||||
'mimetype' => 'text/plain',
|
'mimetype' => 'text/plain',
|
||||||
'size' => 3
|
'size' => 3,
|
||||||
|
'permissions' => \OCP\Constants::PERMISSION_ALL
|
||||||
]);
|
]);
|
||||||
$cache->put('outside.txt', [
|
$cache->put('outside.txt', [
|
||||||
'storage_mtime' => $baseTime - 100,
|
'storage_mtime' => $baseTime - 100,
|
||||||
|
|
Loading…
Reference in New Issue