Skip to content
Snippets Groups Projects
Commit cf366505 authored by Robin Appelman's avatar Robin Appelman
Browse files

make sure folders that are not fully scanned are at least shallow scanned when we open them

the fact that they are in the cache does not mean they are scanned
parent 4be039e6
Branches
No related tags found
No related merge requests found
...@@ -728,7 +728,7 @@ class View { ...@@ -728,7 +728,7 @@ class View {
if ($storage) { if ($storage) {
$cache = $storage->getCache(); $cache = $storage->getCache();
if (!$cache->inCache($internalPath)) { if ($cache->getStatus($internalPath) < Cache\Cache::COMPLETE) {
$scanner = $storage->getScanner(); $scanner = $storage->getScanner();
$scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW); $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
} else { } else {
......
...@@ -97,6 +97,19 @@ class View extends \PHPUnit_Framework_TestCase { ...@@ -97,6 +97,19 @@ class View extends \PHPUnit_Framework_TestCase {
$this->assertEquals(array(), $rootView->getDirectoryContent('/non/existing')); $this->assertEquals(array(), $rootView->getDirectoryContent('/non/existing'));
} }
function testCacheIncompleteFolder() {
$storage1 = $this->getTestStorage(false);
\OC\Files\Filesystem::mount($storage1, array(), '/');
$rootView = new \OC\Files\View('');
$entries = $rootView->getDirectoryContent('/');
$this->assertEquals(3, count($entries));
// /folder will already be in the cache but not scanned
$entries = $rootView->getDirectoryContent('/folder');
$this->assertEquals(1, count($entries));
}
public function testAutoScan() { public function testAutoScan() {
$storage1 = $this->getTestStorage(false); $storage1 = $this->getTestStorage(false);
$storage2 = $this->getTestStorage(false); $storage2 = $this->getTestStorage(false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment