aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-07-01 17:21:09 +0200
committerRobin Appelman <robin@icewind.nl>2021-07-02 16:32:25 +0200
commit9884344230b81bc7e91bd6e1134fb5cb9f071a82 (patch)
tree8659b3d1d6d9fd2f77a34477e8681024356c3562 /lib
parent8ebbd91909dff3c216dd646f430a776219a49c5e (diff)
downloadnextcloud-server-9884344230b81bc7e91bd6e1134fb5cb9f071a82.tar.gz
nextcloud-server-9884344230b81bc7e91bd6e1134fb5cb9f071a82.zip
dont include folder being search in in the results
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Node/Folder.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index 7b480a60955..1f6edfd3bbc 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -280,6 +280,11 @@ class Folder extends Node implements \OCP\Files\Folder {
}, $results);
}, array_values($resultsPerCache), array_keys($resultsPerCache)));
+ // don't include this folder in the results
+ $files = array_filter($files, function (FileInfo $file) {
+ return $file->getPath() !== $this->getPath();
+ });
+
// since results were returned per-cache, they are no longer fully sorted
$order = $query->getOrder();
if ($order) {
@@ -302,7 +307,8 @@ class Folder extends Node implements \OCP\Files\Folder {
private function cacheEntryToFileInfo(IMountPoint $mount, string $appendRoot, ICacheEntry $cacheEntry): FileInfo {
$cacheEntry['internalPath'] = $cacheEntry['path'];
$cacheEntry['path'] = $appendRoot . $cacheEntry->getPath();
- return new \OC\Files\FileInfo($this->path . '/' . $cacheEntry['path'], $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount);
+ $subPath = $cacheEntry['path'] !== '' ? '/' . $cacheEntry['path'] : '';
+ return new \OC\Files\FileInfo($this->path . $subPath, $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount);
}
/**