properly handle cases where cache wrappers block access

`CacheWrapper::formatCacheEntry` can return false for files that should be filtered out

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-08-11 17:35:37 +02:00 committed by MichaIng
parent ae51c54c52
commit c4fa59c540
2 changed files with 4 additions and 3 deletions

View file

@ -328,7 +328,7 @@ class CacheJail extends CacheWrapper {
if ($rawEntry) {
$jailedPath = $this->getJailedPath($rawEntry->getPath());
if ($jailedPath !== null) {
return $this->formatCacheEntry(clone $rawEntry);
return $this->formatCacheEntry(clone $rawEntry) ?: null;
}
}

View file

@ -60,7 +60,7 @@ class CacheWrapper extends Cache {
* Make it easy for wrappers to modify every returned cache entry
*
* @param ICacheEntry $entry
* @return ICacheEntry
* @return ICacheEntry|false
*/
protected function formatCacheEntry($entry) {
return $entry;
@ -311,7 +311,8 @@ class CacheWrapper extends Cache {
public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {
$rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry);
if ($rawEntry) {
return $this->formatCacheEntry(clone $rawEntry);
$entry = $this->formatCacheEntry(clone $rawEntry);
return $entry ?: null;
}
return null;