From e66e8bad1a711ec3073e901e824edc3f92dbd107 Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Mon, 23 Oct 2023 15:26:43 +0200 Subject: [PATCH] Return correct status if touch failed Signed-off-by: Louis Chemineau --- .../lib/Lib/Storage/AmazonS3.php | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index e9398815055..8e2a6b8ea12 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -550,18 +550,20 @@ class AmazonS3 extends \OC\Files\Storage\Common { ]; try { - if (!$this->file_exists($path)) { - $mimeType = $this->mimeDetector->detectPath($path); - $this->getConnection()->putObject([ - 'Bucket' => $this->bucket, - 'Key' => $this->cleanKey($path), - 'Metadata' => $metadata, - 'Body' => '', - 'ContentType' => $mimeType, - 'MetadataDirective' => 'REPLACE', - ]); - $this->testTimeout(); + if ($this->file_exists($path)) { + return false; } + + $mimeType = $this->mimeDetector->detectPath($path); + $this->getConnection()->putObject([ + 'Bucket' => $this->bucket, + 'Key' => $this->cleanKey($path), + 'Metadata' => $metadata, + 'Body' => '', + 'ContentType' => $mimeType, + 'MetadataDirective' => 'REPLACE', + ]); + $this->testTimeout(); } catch (S3Exception $e) { $this->logger->error($e->getMessage(), [ 'app' => 'files_external', -- 2.39.5