From 1c9004409b70461b61d9e6491584f1de6399a2be Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 21 Oct 2014 12:58:26 +0200 Subject: [PATCH] guess mimetype on touch --- apps/files_external/lib/amazons3.php | 4 +++- apps/files_external/lib/swift.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php index 808de16c8a8..ae306fac420 100644 --- a/apps/files_external/lib/amazons3.php +++ b/apps/files_external/lib/amazons3.php @@ -457,11 +457,13 @@ class AmazonS3 extends \OC\Files\Storage\Common { )); $this->testTimeout(); } else { + $mimeType = \OC_Helper::getMimetypeDetector()->detectPath($path); $this->connection->putObject(array( 'Bucket' => $this->bucket, 'Key' => $this->cleanKey($path), 'Metadata' => $metadata, - 'Body' => '' + 'Body' => '', + 'ContentType' => $mimeType )); $this->testTimeout(); } diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php index 6a1e12986fb..22a18202512 100644 --- a/apps/files_external/lib/swift.php +++ b/apps/files_external/lib/swift.php @@ -406,7 +406,8 @@ class Swift extends \OC\Files\Storage\Common { $object->saveMetadata($metadata); return true; } else { - $customHeaders = array('content-type' => 'text/plain'); + $mimeType = \OC_Helper::getMimetypeDetector()->detectPath($path); + $customHeaders = array('content-type' => $mimeType); $metadataHeaders = DataObject::stockHeaders($metadata); $allHeaders = $customHeaders + $metadataHeaders; $this->container->uploadObject($path, '', $allHeaders); -- 2.39.5