Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
  • Loading branch information
CarlSchwan committed Feb 1, 2022
commit 02da4ce1b03d929569d98986b25da99e0c573ddd
13 changes: 6 additions & 7 deletions apps/files/lib/Service/OwnershipTransferService.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,12 @@ public function transfer(IUser $sourceUser,
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);
}

Expand Down