Merge pull request #12494 from nextcloud/cache-notfound-id

return the correct value when trying to get a non existing item from cache by id
This commit is contained in:
Morris Jobke 2018-11-20 09:51:18 +01:00 committed by GitHub
commit cc6c30e769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -150,6 +150,8 @@ class Cache implements ICache {
$data = $this->partial[$file];
}
return $data;
} else if (!$data) {
return $data;
} else {
return self::cacheEntryFromData($data, $this->mimetypeLoader);
}

View File

@ -553,6 +553,7 @@ class CacheTest extends \Test\TestCase {
function testNonExisting() {
$this->assertFalse($this->cache->get('foo.txt'));
$this->assertFalse($this->cache->get(-1));
$this->assertEquals(array(), $this->cache->getFolderContents('foo'));
}