Skip to content

Commit f8c7124

Browse files
authored
Merge pull request #31445 from nextcloud/backport/30953/stable23
[stable23] Init user's file system if not existing on ownership transfer
2 parents cdcbe84 + ab2ac33 commit f8c7124

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)