From 02da4ce1b03d929569d98986b25da99e0c573ddd Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 1 Feb 2022 10:47:40 +0100 Subject: Init user's file system if not existing on ownership transfer This makes it a bit easier to transfer ownership when the new user hasn't already logged in. This still doesn't support encrypted storages because the keys are not generated yet. Signed-off-by: Carl Schwan --- apps/files/lib/Service/OwnershipTransferService.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'apps/files/lib/Service') diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index 93a3a188399..ace7215100e 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -144,13 +144,12 @@ class OwnershipTransferService { throw new TransferOwnershipException("Unknown path provided: $path", 1); } - if ($move && ( - !$view->is_dir($finalTarget) || ( - !$firstLogin && - count($view->getDirectoryContent($finalTarget)) > 0 - ) - ) - ) { + if ($move && !$view->is_dir($finalTarget)) { + // Initialize storage + \OC_Util::setupFS($destinationUser->getUID()); + } + + if ($move && !$firstLogin && count($view->getDirectoryContent($finalTarget)) > 0) { throw new TransferOwnershipException("Destination path does not exists or is not empty", 1); } -- cgit v1.2.3