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>
This commit is contained in:
Carl Schwan 2022-02-01 10:47:40 +01:00 committed by backportbot[bot]
parent 2d9fad1bdd
commit ab2ac33bf9

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