Skip to content

Commit

Permalink
optimize search post-processing for jail wrapper
Browse files Browse the repository at this point in the history
don't both asking the wrapped cache if we know it's not in our jail anyway
  • Loading branch information
icewind1991 committed Aug 15, 2022
1 parent cb97e8f commit ad98d6a
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 (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 ad98d6a

Please sign in to comment.