|
12 | 12 | use OC\Files\Search\SearchOrder; |
13 | 13 | use OC\Files\Search\SearchQuery; |
14 | 14 | use OC\Files\Utils\PathHelper; |
| 15 | +use OC\User\LazyUser; |
15 | 16 | use OCP\Files\Cache\ICacheEntry; |
16 | 17 | use OCP\Files\FileInfo; |
17 | 18 | use OCP\Files\Mount\IMountPoint; |
|
26 | 27 | use OCP\IUserManager; |
27 | 28 |
|
28 | 29 | class Folder extends Node implements \OCP\Files\Folder { |
| 30 | + |
| 31 | + private ?IUserManager $userManager = null; |
| 32 | + |
29 | 33 | /** |
30 | 34 | * Creates a Folder that represents a non-existing path |
31 | 35 | * |
@@ -245,7 +249,26 @@ private function cacheEntryToFileInfo(IMountPoint $mount, string $appendRoot, IC |
245 | 249 | $cacheEntry['internalPath'] = $cacheEntry['path']; |
246 | 250 | $cacheEntry['path'] = rtrim($appendRoot . $cacheEntry->getPath(), '/'); |
247 | 251 | $subPath = $cacheEntry['path'] !== '' ? '/' . $cacheEntry['path'] : ''; |
248 | | - return new \OC\Files\FileInfo($this->path . $subPath, $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount); |
| 252 | + $storage = $mount->getStorage(); |
| 253 | + |
| 254 | + $owner = null; |
| 255 | + $ownerId = $storage->getOwner($cacheEntry['internalPath']); |
| 256 | + if (!empty($ownerId)) { |
| 257 | + // Cache the user manager (for performance) |
| 258 | + if ($this->userManager === null) { |
| 259 | + $this->userManager = \OCP\Server::get(IUserManager::class); |
| 260 | + } |
| 261 | + $owner = new LazyUser($ownerId, $this->userManager); |
| 262 | + } |
| 263 | + |
| 264 | + return new \OC\Files\FileInfo( |
| 265 | + $this->path . $subPath, |
| 266 | + $storage, |
| 267 | + $cacheEntry['internalPath'], |
| 268 | + $cacheEntry, |
| 269 | + $mount, |
| 270 | + $owner, |
| 271 | + ); |
249 | 272 | } |
250 | 273 |
|
251 | 274 | /** |
|
0 commit comments