summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Lib/Storage/AmazonS3.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib/Lib/Storage/AmazonS3.php')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index 9ea278d7229..50bea958b6e 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -50,6 +50,7 @@ use OC\Files\Cache\CacheEntry;
use OC\Files\ObjectStore\S3ConnectionTrait;
use OC\Files\ObjectStore\S3ObjectTrait;
use OCP\Constants;
+use OCP\Files\IMimeTypeDetector;
class AmazonS3 extends \OC\Files\Storage\Common {
use S3ConnectionTrait;
@@ -68,12 +69,16 @@ class AmazonS3 extends \OC\Files\Storage\Common {
/** @var CappedMemoryCache|array */
private $filesCache;
+ /** @var IMimeTypeDetector */
+ private $mimeDetector;
+
public function __construct($parameters) {
parent::__construct($parameters);
$this->parseParams($parameters);
$this->objectCache = new CappedMemoryCache();
$this->directoryCache = new CappedMemoryCache();
$this->filesCache = new CappedMemoryCache();
+ $this->mimeDetector = \OC::$server->get(IMimeTypeDetector::class);
}
/**
@@ -573,7 +578,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
try {
if (!$this->file_exists($path)) {
- $mimeType = \OC::$server->getMimeTypeDetector()->detectPath($path);
+ $mimeType = $this->mimeDetector->detectPath($path);
$this->getConnection()->putObject([
'Bucket' => $this->bucket,
'Key' => $this->cleanKey($path),
@@ -684,7 +689,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
public function writeBack($tmpFile, $path) {
try {
$source = fopen($tmpFile, 'r');
- $this->writeObject($path, $source);
+ $this->writeObject($path, $source, $this->mimeDetector->detectPath($path));
$this->invalidateCache($path);
unlink($tmpFile);