summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-02-01 10:47:40 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2022-03-04 10:39:17 +0000
commitab2ac33bf97c73effd4e6fa50ff32ad2921d3645 (patch)
tree6ef57737c8a7d2394f342740cf0879505393df27
parent2d9fad1bdd8295c93fe5a19743e901fb29922977 (diff)
downloadnextcloud-server-ab2ac33bf97c73effd4e6fa50ff32ad2921d3645.tar.gz
nextcloud-server-ab2ac33bf97c73effd4e6fa50ff32ad2921d3645.zip
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>
-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 670e6419d75..661a7e66e10 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);
}