Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-02-01 12:47:40 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-02-01 15:26:41 +0300
commit02da4ce1b03d929569d98986b25da99e0c573ddd (patch)
tree7ecc03fbd3d26de99b2ec81b47824fffc2a048fb /apps
parentd635d58d19d5ab65c0be754fc32fce99672c249f (diff)
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>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/Service/OwnershipTransferService.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php
index 93a3a188399..ace7215100e 100644
--- a/apps/files/lib/Service/OwnershipTransferService.php
+++ b/apps/files/lib/Service/OwnershipTransferService.php
@@ -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);
}