aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/ObjectStore/S3ObjectTrait.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-04-15 17:14:57 +0200
committerRobin Appelman <robin@icewind.nl>2021-04-21 15:25:58 +0200
commiteffb7dc8ba00c683e3b6717eaf1f358ce1c69b87 (patch)
tree6d9aa4d783242e56f2f971da6d74d05f66894d1e /lib/private/Files/ObjectStore/S3ObjectTrait.php
parentd2ea068552eb144d491b76e0a0ef8266144dcf45 (diff)
downloadnextcloud-server-effb7dc8ba00c683e3b6717eaf1f358ce1c69b87.tar.gz
nextcloud-server-effb7dc8ba00c683e3b6717eaf1f358ce1c69b87.zip
set mimetype for objects uploaded to object storages
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/ObjectStore/S3ObjectTrait.php')
-rw-r--r--lib/private/Files/ObjectStore/S3ObjectTrait.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index 4d6ac3608df..250f8fd1edd 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -78,10 +78,11 @@ trait S3ObjectTrait {
/**
* @param string $urn the unified resource name used to identify the object
* @param resource $stream stream with the data to write
+ * @param string|null $mimetype the mimetype to set for the remove object @since 22.0.0
* @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0
*/
- public function writeObject($urn, $stream) {
+ public function writeObject($urn, $stream, string $mimetype = null) {
$count = 0;
$countStream = CallbackWrapper::wrap($stream, function ($read) use (&$count) {
$count += $read;
@@ -91,6 +92,9 @@ trait S3ObjectTrait {
'bucket' => $this->bucket,
'key' => $urn,
'part_size' => $this->uploadPartSize,
+ 'params' => [
+ 'ContentType' => $mimetype
+ ]
]);
try {