Return correct status if touch failed

Signed-off-by: Louis Chemineau <louis@chmn.me>
pull/41062/head
Louis Chemineau 2023-10-23 15:26:43 +07:00
parent 834c9a209e
commit e66e8bad1a
No known key found for this signature in database
1 changed files with 13 additions and 11 deletions

@ -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',