From 5fc7c22034add17b765962cfb27ac27425be1bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 17 Nov 2020 14:29:08 +0100 Subject: [PATCH 1/2] Delete object to cleanup leftover of paths when removing directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/files_external/lib/Lib/Storage/AmazonS3.php | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 220822f93961b..1bdd11e39bd63 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -318,6 +318,7 @@ private function batchDelete($path = null) { } // we reached the end when the list is no longer truncated } while ($objects['IsTruncated']); + $this->deleteObject($path); } catch (S3Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); return false; From 3246eea0b679861c4f7266fa043a134eee8b416f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 17 Nov 2020 14:29:56 +0100 Subject: [PATCH 2/2] Make sure that a empty directory can still be deleted when copied from another storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Files/Storage/Common.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 5a9cbe7c0081f..c478e9bcffc8c 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -612,6 +612,7 @@ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t $dh = $sourceStorage->opendir($sourceInternalPath); $result = $this->mkdir($targetInternalPath); if (is_resource($dh)) { + $result = true; while ($result and ($file = readdir($dh)) !== false) { if (!Filesystem::isIgnoredDir($file)) { $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file);