]> source.dussan.org Git - nextcloud-server.git/commitdiff
return a lazy folder from Root::getUserFolder
authorRobin Appelman <robin@icewind.nl>
Tue, 8 Mar 2022 15:20:05 +0000 (16:20 +0100)
committerRobin Appelman <robin@icewind.nl>
Thu, 24 Mar 2022 16:01:08 +0000 (17:01 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Node/Root.php

index 88ac4a31d34e1e4b9ba17a90c5c22448c35fdee7..e8159b23fec95bad7767914e66a4b2899ea38e45 100644 (file)
@@ -38,6 +38,7 @@ use OC\Files\Mount\MountPoint;
 use OC\Files\View;
 use OC\Hooks\PublicEmitter;
 use OC\User\NoUserException;
+use OCP\Constants;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\Files\Config\IUserMountCache;
 use OCP\Files\Events\Node\FilesystemTornDownEvent;
@@ -380,16 +381,19 @@ class Root extends Folder implements IRootFolder {
                $userId = $userObject->getUID();
 
                if (!$this->userFolderCache->hasKey($userId)) {
-                       \OC\Files\Filesystem::initMountPoints($userId);
-
-                       try {
-                               $folder = $this->get('/' . $userId . '/files');
-                       } catch (NotFoundException $e) {
-                               if (!$this->nodeExists('/' . $userId)) {
-                                       $this->newFolder('/' . $userId);
+                       $folder = new LazyFolder(function () use ($userId) {
+                               try {
+                                       return $this->get('/' . $userId . '/files');
+                               } catch (NotFoundException $e) {
+                                       if (!$this->nodeExists('/' . $userId)) {
+                                               $this->newFolder('/' . $userId);
+                                       }
+                                       return $this->newFolder('/' . $userId . '/files');
                                }
-                               $folder = $this->newFolder('/' . $userId . '/files');
-                       }
+                       }, [
+                               'path' => '/' . $userId . '/files',
+                               'permissions' => Constants::PERMISSION_ALL,
+                       ]);
 
                        $this->userFolderCache->set($userId, $folder);
                }