diff options
author | Robin Appelman <robin@icewind.nl> | 2021-07-01 17:21:09 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-07-02 15:52:17 +0000 |
commit | cb0e76105e1415be1a52c3b2042932ab8f64c728 (patch) | |
tree | f084915e43bea0a78b87b192e4345146ced910e3 /lib | |
parent | 6c24e13d4b490f97fbd288ab3931a33d6f63bc1a (diff) | |
download | nextcloud-server-cb0e76105e1415be1a52c3b2042932ab8f64c728.tar.gz nextcloud-server-cb0e76105e1415be1a52c3b2042932ab8f64c728.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.php | 8 |
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); } /** |