Skip to content

Commit

Permalink
Return correct status if touch failed
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Oct 23, 2023
1 parent 834c9a2 commit e66e8ba
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 e66e8ba

Please sign in to comment.