aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-07-09 18:33:45 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-07-30 11:05:22 +0000
commite102c752f907d8592b325f07e5baec9eb4391562 (patch)
treec6df1a759ad0ca2245e30d09d8ac850b953b7cab /lib
parent2a6e868de6e9d61de75597eb72e1f40f47176c19 (diff)
downloadnextcloud-server-e102c752f907d8592b325f07e5baec9eb4391562.tar.gz
nextcloud-server-e102c752f907d8592b325f07e5baec9eb4391562.zip
fix: `OCP\Files\Node\Folder::search` was not setting the owner
The owner was not set on the file info causing e.g. webdav searches to never return the known owner. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
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 7eda353d2b2..a510465383c 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -37,6 +37,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;
@@ -51,6 +52,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
*
@@ -270,7 +274,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,
+ );
}
/**