Skip to content

Commit

Permalink
Merge pull request #31446 from nextcloud/backport/30953/stable22
Browse files Browse the repository at this point in the history
[stable22] Init user's file system if not existing on ownership transfer
  • Loading branch information
PVince81 authored Mar 7, 2022
2 parents 9ffbbd6 + 034a6e9 commit 4ee10c8
Showing 1 changed file with 6 additions and 7 deletions.
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

0 comments on commit 4ee10c8

Please sign in to comment.