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

fix cache behaviour for non existing files

parent 317cd4c7
No related branches found
No related tags found
No related merge requests found
......@@ -691,20 +691,22 @@ class View {
$data = $cache->get($internalPath);
if ($data['mimetype'] === 'httpd/unix-directory') {
//add the sizes of other mountpoints to the folder
$mountPoints = Filesystem::getMountPoints($path);
foreach ($mountPoints as $mountPoint) {
$subStorage = Filesystem::getStorage($mountPoint);
$subCache = $subStorage->getCache();
$rootEntry = $subCache->get('');
$data['size'] += $rootEntry['size'];
if ($data) {
if ($data['mimetype'] === 'httpd/unix-directory') {
//add the sizes of other mountpoints to the folder
$mountPoints = Filesystem::getMountPoints($path);
foreach ($mountPoints as $mountPoint) {
$subStorage = Filesystem::getStorage($mountPoint);
$subCache = $subStorage->getCache();
$rootEntry = $subCache->get('');
$data['size'] += $rootEntry['size'];
}
}
}
$permissionsCache = $storage->getPermissionsCache();
$data['permissions'] = $permissionsCache->get($data['fileid'], \OC_User::getUser());
$permissionsCache = $storage->getPermissionsCache();
$data['permissions'] = $permissionsCache->get($data['fileid'], \OC_User::getUser());
}
}
return $data;
}
......@@ -888,7 +890,7 @@ class View {
* @param string $path
* @return string
*/
public function getETag($path){
public function getETag($path) {
/**
* @var Storage\Storage $storage
* @var string $internalPath
......
......@@ -192,6 +192,11 @@ class Cache extends \UnitTestCase {
$this->assertEquals($file3, $this->cache->getIncomplete());
}
function testNonExisting() {
$this->assertFalse($this->cache->get('foo.txt'));
$this->assertEquals(array(), $this->cache->getFolderContents('foo'));
}
public function tearDown() {
$this->cache->clear();
}
......
......@@ -92,6 +92,9 @@ class View extends \PHPUnit_Framework_TestCase {
$cachedData = $rootView->getFileInfo('/foo.txt');
$this->assertTrue($cachedData['encrypted']);
$this->assertEquals($cachedData['fileid'], $id);
$this->assertFalse($rootView->getFileInfo('/non/existing'));
$this->assertEquals(array(), $rootView->getDirectoryContent('/non/existing'));
}
public function testAutoScan() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment