Skip to content

Commit c5d8240

Browse files
authored
Merge pull request #41062 from nextcloud/artonge/fix/return_fals_if_touch_fails
Return correct status if touch failed
2 parents efe68d0 + e66e8ba commit c5d8240

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

apps/files_external/lib/Lib/Storage/AmazonS3.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -550,18 +550,20 @@ public function touch($path, $mtime = null) {
550550
];
551551

552552
try {
553-
if (!$this->file_exists($path)) {
554-
$mimeType = $this->mimeDetector->detectPath($path);
555-
$this->getConnection()->putObject([
556-
'Bucket' => $this->bucket,
557-
'Key' => $this->cleanKey($path),
558-
'Metadata' => $metadata,
559-
'Body' => '',
560-
'ContentType' => $mimeType,
561-
'MetadataDirective' => 'REPLACE',
562-
]);
563-
$this->testTimeout();
553+
if ($this->file_exists($path)) {
554+
return false;
564555
}
556+
557+
$mimeType = $this->mimeDetector->detectPath($path);
558+
$this->getConnection()->putObject([
559+
'Bucket' => $this->bucket,
560+
'Key' => $this->cleanKey($path),
561+
'Metadata' => $metadata,
562+
'Body' => '',
563+
'ContentType' => $mimeType,
564+
'MetadataDirective' => 'REPLACE',
565+
]);
566+
$this->testTimeout();
565567
} catch (S3Exception $e) {
566568
$this->logger->error($e->getMessage(), [
567569
'app' => 'files_external',

0 commit comments

Comments
 (0)