diff options
-rw-r--r-- | apps/files_sharing/lib/Cache.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Cache/Wrapper/CacheJail.php | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index 80f9f64d1aa..0025bb98fbb 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -183,16 +183,18 @@ class Cache extends CacheJail { } public function getQueryFilterForStorage(): ISearchOperator { + $storageFilter = \OC\Files\Cache\Cache::getQueryFilterForStorage(); + // Do the normal jail behavior for non files if ($this->storage->getItemType() !== 'file') { - return parent::getQueryFilterForStorage(); + return $this->addJailFilterQuery($storageFilter); } // for single file shares we don't need to do the LIKE return new SearchBinaryOperator( ISearchBinaryOperator::OPERATOR_AND, [ - \OC\Files\Cache\Cache::getQueryFilterForStorage(), + $storageFilter, new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', $this->getGetUnjailedRoot()), ] ); diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 834c9fd3d72..996f0c02603 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -306,10 +306,14 @@ class CacheJail extends CacheWrapper { } public function getQueryFilterForStorage(): ISearchOperator { + return $this->addJailFilterQuery($this->getCache()->getQueryFilterForStorage()); + } + + protected function addJailFilterQuery(ISearchOperator $filter): ISearchOperator { if ($this->getGetUnjailedRoot() !== '' && $this->getGetUnjailedRoot() !== '/') { return new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [ - $this->getCache()->getQueryFilterForStorage(), + $filter, new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', $this->getGetUnjailedRoot()), @@ -319,7 +323,7 @@ class CacheJail extends CacheWrapper { ] ); } else { - return $this->getCache()->getQueryFilterForStorage(); + return $filter; } } |