From 9d6c2ce301f9cb35a6bb7e0a2dbfccb92c0aa996 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 15 Aug 2022 20:52:12 +0200 Subject: [PATCH] optimize search post-processing for jail wrapper don't both asking the wrapped cache if we know it's not in our jail anyway Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Wrapper/CacheJail.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 4053042edd969..834c9fd3d727d 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -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; + } } }