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

Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Aug 16, 2022
1 parent cb97e8f commit 9d6c2ce
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 9d6c2ce

Please sign in to comment.