]> source.dussan.org Git - nextcloud-server.git/commitdiff
directly build the search filter for shared storage instead of setting up the source... 33656/head
authorRobin Appelman <robin@icewind.nl>
Wed, 17 Aug 2022 09:58:57 +0000 (11:58 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Tue, 23 Aug 2022 12:19:14 +0000 (12:19 +0000)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/Cache.php
lib/private/Files/Cache/Wrapper/CacheJail.php

index d245727b138ebc7e0ea10c1e32ccc3b3340957f2..99f4f006997923a128ffc22047217044bf7f0528 100644 (file)
@@ -182,16 +182,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()),
                        ]
                );
index 7183a6c0d2a6daf37320fdce97365ca73f26cce7..ffd446dae30baee2eb973d1e74d4919af6200a4b 100644 (file)
@@ -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;
                }
        }