diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-12-04 13:53:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-04 13:53:43 +0100 |
commit | 50985e54612d7a3a0917e2772afde504ae3b67f0 (patch) | |
tree | c64820fc952ad45278f284f8ea6804bfd84b6988 /apps/files/lib | |
parent | bfb9ccec1fce79bb068b2a58ba597a63de8412ed (diff) | |
parent | 70f4e7e10a87a912ccaf82693beb58ebe1e265a5 (diff) | |
download | nextcloud-server-50985e54612d7a3a0917e2772afde504ae3b67f0.tar.gz nextcloud-server-50985e54612d7a3a0917e2772afde504ae3b67f0.zip |
Merge pull request #17913 from nextcloud/fix/transfer-ownership-move-files-error-handling
Catch file transfer error and stop transfer ownership command
Diffstat (limited to 'apps/files/lib')
-rw-r--r-- | apps/files/lib/Service/OwnershipTransferService.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php index d664163041f..b5d0ee315a1 100644 --- a/apps/files/lib/Service/OwnershipTransferService.php +++ b/apps/files/lib/Service/OwnershipTransferService.php @@ -215,6 +215,9 @@ class OwnershipTransferService { return $shares; } + /** + * @throws TransferOwnershipException + */ protected function transferFiles(string $sourceUid, string $sourcePath, string $finalTarget, @@ -228,7 +231,9 @@ class OwnershipTransferService { $view->mkdir($finalTarget); $finalTarget = $finalTarget . '/' . basename($sourcePath); } - $view->rename($sourcePath, $finalTarget); + if ($view->rename($sourcePath, $finalTarget) === false) { + throw new TransferOwnershipException("Could not transfer files", 1); + } if (!is_dir("$sourceUid/files")) { // because the files folder is moved away we need to recreate it $view->mkdir("$sourceUid/files"); |