Skip to content

Commit

Permalink
Merge pull request #33550 from nextcloud/jail-search-post
Browse files Browse the repository at this point in the history
optimize search post-processing for jail wrapper
  • Loading branch information
PVince81 authored Aug 17, 2022
2 parents 2360d88 + 9d6c2ce commit 11d5a1d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/private/Files/Cache/Wrapper/CacheJail.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,13 @@ public function getQueryFilterForStorage(): ISearchOperator {
}

public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {
$rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry);
if ($rawEntry) {
$jailedPath = $this->getJailedPath($rawEntry->getPath());
if ($jailedPath !== null) {
return $this->formatCacheEntry(clone $rawEntry) ?: null;
if ($this->getGetUnjailedRoot() === '' || strpos($rawEntry->getPath(), $this->getGetUnjailedRoot()) === 0) {
$rawEntry = $this->getCache()->getCacheEntryFromSearchResult($rawEntry);
if ($rawEntry) {
$jailedPath = $this->getJailedPath($rawEntry->getPath());
if ($jailedPath !== null) {
return $this->formatCacheEntry(clone $rawEntry) ?: null;
}
}
}

Expand Down

0 comments on commit 11d5a1d

Please sign in to comment.