Skip to content

Commit

Permalink
Merge pull request #41236 from nextcloud/backport/41062/stable27
Browse files Browse the repository at this point in the history
[stable27] Return correct status if touch failed
  • Loading branch information
artonge authored Nov 7, 2023
2 parents fb3f63c + 17ca96d commit 8b6750c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions apps/files_external/lib/Lib/Storage/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,18 +550,20 @@ public function touch($path, $mtime = null) {
];

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',
Expand Down

0 comments on commit 8b6750c

Please sign in to comment.