Skip to content

Commit 9f3a2ab

Browse files
icewind1991skjnldsv
authored andcommitted
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>
1 parent 63d3931 commit 9f3a2ab

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/private/Files/Cache/Wrapper/CacheJail.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEnt
328328
if ($rawEntry) {
329329
$jailedPath = $this->getJailedPath($rawEntry->getPath());
330330
if ($jailedPath !== null) {
331-
return $this->formatCacheEntry(clone $rawEntry);
331+
return $this->formatCacheEntry(clone $rawEntry) || null;
332332
}
333333
}
334334

lib/private/Files/Cache/Wrapper/CacheWrapper.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function getCache() {
6060
* Make it easy for wrappers to modify every returned cache entry
6161
*
6262
* @param ICacheEntry $entry
63-
* @return ICacheEntry
63+
* @return ICacheEntry|false
6464
*/
6565
protected function formatCacheEntry($entry) {
6666
return $entry;
@@ -311,7 +311,8 @@ public function getQueryFilterForStorage(): ISearchOperator {
311311
public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {
312312
$rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry);
313313
if ($rawEntry) {
314-
return $this->formatCacheEntry(clone $rawEntry);
314+
$entry = $this->formatCacheEntry(clone $rawEntry);
315+
return $entry ?: null;
315316
}
316317

317318
return null;

0 commit comments

Comments
 (0)