Skip to content

Commit 352c4be

Browse files
committed
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>
1 parent b47a42f commit 352c4be

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

apps/files/lib/Service/OwnershipTransferService.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,12 @@ public function transfer(IUser $sourceUser,
144144
throw new TransferOwnershipException("Unknown path provided: $path", 1);
145145
}
146146

147-
if ($move && (
148-
!$view->is_dir($finalTarget) || (
149-
!$firstLogin &&
150-
count($view->getDirectoryContent($finalTarget)) > 0
151-
)
152-
)
153-
) {
147+
if ($move && !$view->is_dir($finalTarget)) {
148+
// Initialize storage
149+
\OC_Util::setupFS($destinationUser->getUID());
150+
}
151+
152+
if ($move && !$firstLogin && count($view->getDirectoryContent($finalTarget)) > 0) {
154153
throw new TransferOwnershipException("Destination path does not exists or is not empty", 1);
155154
}
156155

0 commit comments

Comments
 (0)