Skip to content

Commit

Permalink
Merge pull request #21734 from nextcloud/external-s3-no-touch
Browse files Browse the repository at this point in the history
disable touch to update mtime for external s3 storage
  • Loading branch information
MorrisJobke authored Aug 20, 2020
2 parents 03603db + 0d6910a commit ac73982
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions apps/files_external/lib/Lib/Storage/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,31 +550,15 @@ public function fopen($path, $mode) {
}

public function touch($path, $mtime = null) {
$path = $this->normalizePath($path);

$metadata = [];
if (is_null($mtime)) {
$mtime = time();
}
$metadata = [
'lastmodified' => gmdate(\DateTime::RFC1123, $mtime)
];

$fileType = $this->filetype($path);
try {
if ($fileType !== false) {
if ($fileType === 'dir' && !$this->isRoot($path)) {
$path .= '/';
}
$this->getConnection()->copyObject([
'Bucket' => $this->bucket,
'Key' => $this->cleanKey($path),
'Metadata' => $metadata,
'CopySource' => $this->bucket . '/' . $path,
'MetadataDirective' => 'REPLACE',
]);
$this->testTimeout();
} else {
if (!$this->file_exists($path)) {
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($path);
$this->getConnection()->putObject([
'Bucket' => $this->bucket,
Expand Down

0 comments on commit ac73982

Please sign in to comment.