Merge pull request #29509 from nextcloud/backport/28385/stable22

[stable22] properly handle cases where cache wrappers block access
This commit is contained in:
Louis 2021-11-25 14:36:39 +01:00 committed by GitHub
commit 62416a35ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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;