From 0d7fdbc1c6cca41c2127c85e646a1496b945acbe Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 10 Jan 2022 11:15:22 +0100 Subject: [PATCH] Fix fail when keys/files folder already exists Fixes an issue with transfer ownership in move mode where the folder "files_encryption/keys/files" already exists. Instead of failing, its existence is checked before calling mkdir. Signed-off-by: Vincent Petry --- lib/private/Files/Storage/Wrapper/Encryption.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 3ee715ae3d32a..3fb21fbc01ccc 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -768,7 +768,11 @@ private function copyBetweenStorage(Storage\IStorage $sourceStorage, $sourceInte if ($sourceStorage->is_dir($sourceInternalPath)) { $dh = $sourceStorage->opendir($sourceInternalPath); - $result = $this->mkdir($targetInternalPath); + if (!$this->is_dir($targetInternalPath)) { + $result = $this->mkdir($targetInternalPath); + } else { + $result = true; + } if (is_resource($dh)) { while ($result and ($file = readdir($dh)) !== false) { if (!Filesystem::isIgnoredDir($file)) {