Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-06-22 23:25:45 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2015-06-22 23:25:45 +0300
commit25581c7b638a5349c0180b6210b2e1d332e19e49 (patch)
tree4f4fd74cc71adcc05791426a2a7f7742af3a6fb4 /apps
parent5cfcda3e95d0541f7f281e31067fde668f64ec44 (diff)
parentf98030020f5b368d24a8c25c24ef59dd4539137b (diff)
Merge pull request #16940 from owncloud/ext-s3-touchmtimefix
Properly set mtime on S3 for touch operation
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/lib/amazons3.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index 763cf59aa4c..02a02710a14 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -443,9 +443,12 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$path = $this->normalizePath($path);
$metadata = array();
- if (!is_null($mtime)) {
- $metadata = array('lastmodified' => $mtime);
+ if (is_null($mtime)) {
+ $mtime = time();
}
+ $metadata = [
+ 'lastmodified' => gmdate(\Aws\Common\Enum\DateFormat::RFC1123, $mtime)
+ ];
$fileType = $this->filetype($path);
try {
@@ -453,22 +456,24 @@ class AmazonS3 extends \OC\Files\Storage\Common {
if ($fileType === 'dir' && ! $this->isRoot($path)) {
$path .= '/';
}
- $this->getConnection()->copyObject(array(
+ $this->getConnection()->copyObject([
'Bucket' => $this->bucket,
'Key' => $this->cleanKey($path),
'Metadata' => $metadata,
- 'CopySource' => $this->bucket . '/' . $path
- ));
+ 'CopySource' => $this->bucket . '/' . $path,
+ 'MetadataDirective' => 'REPLACE',
+ ]);
$this->testTimeout();
} else {
$mimeType = \OC_Helper::getMimetypeDetector()->detectPath($path);
- $this->getConnection()->putObject(array(
+ $this->getConnection()->putObject([
'Bucket' => $this->bucket,
'Key' => $this->cleanKey($path),
'Metadata' => $metadata,
'Body' => '',
- 'ContentType' => $mimeType
- ));
+ 'ContentType' => $mimeType,
+ 'MetadataDirective' => 'REPLACE',
+ ]);
$this->testTimeout();
}
} catch (S3Exception $e) {