Merge pull request #31446 from nextcloud/backport/30953/stable22

[stable22] Init user's file system if not existing on ownership transfer
This commit is contained in:
Vincent Petry 2022-03-07 12:24:48 +01:00 committed by GitHub
commit 4ee10c85dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}