Skip to content

Commit 11d5a1d

Browse files
authored
Merge pull request #33550 from nextcloud/jail-search-post
optimize search post-processing for jail wrapper
2 parents 2360d88 + 9d6c2ce commit 11d5a1d

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,13 @@ public function getQueryFilterForStorage(): ISearchOperator {
324324
}
325325

326326
public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {
327-
$rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry);
328-
if ($rawEntry) {
329-
$jailedPath = $this->getJailedPath($rawEntry->getPath());
330-
if ($jailedPath !== null) {
331-
return $this->formatCacheEntry(clone $rawEntry) ?: null;
327+
if ($this->getGetUnjailedRoot() === '' || strpos($rawEntry->getPath(), $this->getGetUnjailedRoot()) === 0) {
328+
$rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry);
329+
if ($rawEntry) {
330+
$jailedPath = $this->getJailedPath($rawEntry->getPath());
331+
if ($jailedPath !== null) {
332+
return $this->formatCacheEntry(clone $rawEntry) ?: null;
333+
}
332334
}
333335
}
334336

0 commit comments

Comments
 (0)