]> source.dussan.org Git - nextcloud-server.git/commitdiff
Return correct status if touch failed 41237/head
authorLouis Chemineau <louis@chmn.me>
Mon, 23 Oct 2023 13:26:43 +0000 (15:26 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Thu, 2 Nov 2023 10:13:35 +0000 (10:13 +0000)
Signed-off-by: Louis Chemineau <louis@chmn.me>
apps/files_external/lib/Lib/Storage/AmazonS3.php

index 6845d1f69c255ea3558384d09635c42eb5332897..62184c733f2845348cd7bf09b40a980ce4239bbd 100644 (file)
@@ -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',