diff options
author | Robin Appelman <robin@icewind.nl> | 2022-08-15 20:52:12 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-08-18 13:39:36 +0200 |
commit | 9deae5b17a89376176ce2452c4c0b4050410639c (patch) | |
tree | 6b80cca9f2bd5612dda2e98cdf164395342bc705 | |
parent | dbab6a648b79a51898ff22bae9ae9c3ff9d7b9bf (diff) | |
download | nextcloud-server-9deae5b17a89376176ce2452c4c0b4050410639c.tar.gz nextcloud-server-9deae5b17a89376176ce2452c4c0b4050410639c.zip |
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 <robin@icewind.nl>
-rw-r--r-- | lib/private/Files/Cache/Wrapper/CacheJail.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 7183a6c0d2a..2c8a5b4dbf0 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -324,11 +324,13 @@ class CacheJail extends CacheWrapper { } 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; + } } } |