mirror of
https://github.com/nextcloud/server.git
synced 2026-06-14 03:02:01 -04:00
Merge pull request #48744 from nextcloud/backport/46124/stable28
[stable28] fix: Fix "Unknown path" error when source user `files` folder has not been initialized
This commit is contained in:
commit
566d48d5fd
1 changed files with 5 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue