diff options
author | Julius Knorr <jus@bitgrid.net> | 2024-10-28 09:17:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-28 09:17:36 +0100 |
commit | 566d48d5fd2bda54aa920917cdf126ea95e5c7cf (patch) | |
tree | a89541b41bc2563e2a270ebd2da56d3e592fc3b6 /apps | |
parent | 343c6655425ffe8016a77d2a33f04f60a6dc5e37 (diff) | |
parent | 0f9cf04537ecdd5d0831365e83850c95ac002547 (diff) | |
download | nextcloud-server-566d48d5fd2bda54aa920917cdf126ea95e5c7cf.tar.gz nextcloud-server-566d48d5fd2bda54aa920917cdf126ea95e5c7cf.zip |
Merge pull request #48744 from nextcloud/backport/46124/stable28
[stable28] fix: Fix "Unknown path" error when source user `files` folder has not been initialized
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/lib/Service/OwnershipTransferService.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 1461ee1400e..283a49932f7 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -69,6 +69,7 @@ class OwnershipTransferService { private IMountManager $mountManager, private IUserMountCache $userMountCache, private IUserManager $userManager, + private IRootFolder $rootFolder, ) { $this->encryptionManager = $encryptionManager; } @@ -107,8 +108,10 @@ class OwnershipTransferService { // Requesting the user folder will set it up if the user hasn't logged in before // We need a setupFS for the full filesystem setup before as otherwise we will just return // a lazy root folder which does not create the destination users folder + \OC_Util::setupFS($sourceUser->getUID()); \OC_Util::setupFS($destinationUser->getUID()); - \OC::$server->getUserFolder($destinationUser->getUID()); + $this->rootFolder->getUserFolder($sourceUser->getUID()); + $this->rootFolder->getUserFolder($destinationUser->getUID()); Filesystem::initMountPoints($sourceUid); Filesystem::initMountPoints($destinationUid); @@ -435,7 +438,6 @@ class OwnershipTransferService { ):void { $output->writeln("Restoring shares ..."); $progress = new ProgressBar($output, count($shares)); - $rootFolder = \OCP\Server::get(IRootFolder::class); foreach ($shares as ['share' => $share, 'suffix' => $suffix]) { try { @@ -475,7 +477,7 @@ class OwnershipTransferService { } catch (\OCP\Files\NotFoundException) { // ID has changed due to transfer between different storages // Try to get the new ID from the target path and suffix of the share - $node = $rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix)); + $node = $this->rootFolder->get(Filesystem::normalizePath($targetLocation . '/' . $suffix)); $newNodeId = $node->getId(); $output->writeln('Had to change node id to ' . $newNodeId, OutputInterface::VERBOSITY_VERY_VERBOSE); } |