Skip to content

Commit

Permalink
Add result of getQueryFilterForStorage in path filtering
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Apr 16, 2024
1 parent 91e6cdd commit e3a9de0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions apps/dav/lib/Files/FileSearchBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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 . '/%',
''
)
]

Check notice

Code scanning / Psalm

ArgumentTypeCoercion Note

Argument 2 of OC\Files\Search\SearchBinaryOperator::__construct expects array<array-key, OC\Files\Search\SearchBinaryOperator|OC\Files\Search\SearchComparison>, but parent type list{OCP\Files\Search\ISearchOperator, OC\Files\Search\SearchComparison} provided
);
}

Expand Down

0 comments on commit e3a9de0

Please sign in to comment.