Skip to content

Commit

Permalink
Merge pull request #41237 from nextcloud/backport/41062/stable26
Browse files Browse the repository at this point in the history
[stable26] Return correct status if touch failed
  • Loading branch information
artonge authored Nov 7, 2023
2 parents c9d497c + 9e905a2 commit 58ee21f
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 58ee21f

Please sign in to comment.