diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-02-01 10:47:40 +0100 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-02-01 13:26:41 +0100 |
commit | 02da4ce1b03d929569d98986b25da99e0c573ddd (patch) | |
tree | 7ecc03fbd3d26de99b2ec81b47824fffc2a048fb /apps | |
parent | d635d58d19d5ab65c0be754fc32fce99672c249f (diff) | |
download | nextcloud-server-02da4ce1b03d929569d98986b25da99e0c573ddd.tar.gz nextcloud-server-02da4ce1b03d929569d98986b25da99e0c573ddd.zip |
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 <carl@carlschwan.eu>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/lib/Service/OwnershipTransferService.php | 13 |
1 files changed, 6 insertions, 7 deletions
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); } |