Browse Source
Merge pull request #41062 from nextcloud/artonge/fix/return_fals_if_touch_fails
Return correct status if touch failed
pull/41094/head
Louis
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
13 additions and
11 deletions
-
apps/files_external/lib/Lib/Storage/AmazonS3.php
|
|
|
@ -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', |
|
|
|
|