aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-07-30 13:04:15 +0200
committerGitHub <noreply@github.com>2024-07-30 13:04:15 +0200
commit21f558b12bdb985ec312ac8973f2be9c0d73f824 (patch)
tree5c09ea1a8ad508986e9152109955ea7c5c28a187 /lib
parentb9f35a73151ef1bd42959d4b39268856deca2f0c (diff)
parentcf935e33ae08f49fec42ec5bc9ceca2d8830ef4b (diff)
downloadnextcloud-server-21f558b12bdb985ec312ac8973f2be9c0d73f824.tar.gz
nextcloud-server-21f558b12bdb985ec312ac8973f2be9c0d73f824.zip
Merge pull request #46379 from nextcloud/fix/folder-search-owner
fix: `OCP\Files\Node\Folder::search` was not setting the owner
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Node/Folder.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index 7ae55d046b9..79daa63d7b3 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -12,6 +12,7 @@ use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchOrder;
use OC\Files\Search\SearchQuery;
use OC\Files\Utils\PathHelper;
+use OC\User\LazyUser;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\FileInfo;
use OCP\Files\Mount\IMountPoint;
@@ -26,6 +27,9 @@ use OCP\Files\Search\ISearchQuery;
use OCP\IUserManager;
class Folder extends Node implements \OCP\Files\Folder {
+
+ private ?IUserManager $userManager = null;
+
/**
* Creates a Folder that represents a non-existing path
*
@@ -245,7 +249,26 @@ class Folder extends Node implements \OCP\Files\Folder {
$cacheEntry['internalPath'] = $cacheEntry['path'];
$cacheEntry['path'] = rtrim($appendRoot . $cacheEntry->getPath(), '/');
$subPath = $cacheEntry['path'] !== '' ? '/' . $cacheEntry['path'] : '';
- return new \OC\Files\FileInfo($this->path . $subPath, $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount);
+ $storage = $mount->getStorage();
+
+ $owner = null;
+ $ownerId = $storage->getOwner($cacheEntry['internalPath']);
+ if (!empty($ownerId)) {
+ // Cache the user manager (for performance)
+ if ($this->userManager === null) {
+ $this->userManager = \OCP\Server::get(IUserManager::class);
+ }
+ $owner = new LazyUser($ownerId, $this->userManager);
+ }
+
+ return new \OC\Files\FileInfo(
+ $this->path . $subPath,
+ $storage,
+ $cacheEntry['internalPath'],
+ $cacheEntry,
+ $mount,
+ $owner,
+ );
}
/**