From e3a9de0ce80a66247234a1d9bafabafdeeb14f2b Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Tue, 16 Apr 2024 18:44:39 +0200 Subject: [PATCH] Add result of getQueryFilterForStorage in path filtering Signed-off-by: Louis Chemineau --- apps/dav/lib/Files/FileSearchBackend.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 1585db326cf3f..c1713994343f6 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -169,6 +169,7 @@ public function search(Query $search): array { if (!$node instanceof Directory) { throw new \InvalidArgumentException('Search is only supported on directories'); } + $fileInfo = $node->getFileInfo(); /** @var Folder $folder */ $folder = $this->rootFolder->get($fileInfo->getPath()); @@ -179,11 +180,18 @@ public function search(Query $search): array { } else { $internalPath = $folder->getInternalPath(); } - $scopes[] = new SearchComparison( - ISearchComparison::COMPARE_LIKE, - 'path', - $internalPath . '/%', - '' + + $scopes[] = new SearchBinaryOperator( + ISearchBinaryOperator::OPERATOR_AND, + [ + $folderStorage->getCache()->getQueryFilterForStorage(), + new SearchComparison( + ISearchComparison::COMPARE_LIKE, + 'path', + $internalPath . '/%', + '' + ) + ] ); }