]> source.dussan.org Git - nextcloud-server.git/commitdiff
guess mimetype on touch
authorJörn Friedrich Dreyer <jfd@butonic.de>
Tue, 21 Oct 2014 10:58:26 +0000 (12:58 +0200)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Tue, 21 Oct 2014 10:58:26 +0000 (12:58 +0200)
apps/files_external/lib/amazons3.php
apps/files_external/lib/swift.php

index 808de16c8a82d992258b6644d37b142e7579fcf6..ae306fac420be25f46649c68f186ed301c84979b 100644 (file)
@@ -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();
                        }
index 6a1e12986fbb80c0d8cd4613d43092caa257225d..22a18202512705f97444ace5f8a15f5307fd6608 100644 (file)
@@ -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);