Keep miemtype handling for writeObject

Signed-off-by: Bernd.Rederlechner@t-systems.com <bernd.rederlechner@t-systems.com>
This commit is contained in:
Bernd.Rederlechner@t-systems.com 2021-05-07 08:40:10 +00:00
parent cafb437e11
commit f139d2bf9d
1 changed files with 7 additions and 6 deletions

View File

@ -85,14 +85,13 @@ trait S3ObjectTrait {
}
/**
* @param string $urn the unified resource name used to identify the object
* @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;
@ -102,7 +101,9 @@ trait S3ObjectTrait {
'bucket' => $this->bucket,
'key' => $urn,
'part_size' => $this->uploadPartSize,
'params' => $this->getSseKmsPutParameters(),
'params' => [
'ContentType' => $mimetype
] + $this->getSseKmsPutParameters(),
];
$uploader = new MultipartUploader($this->getConnection(), $countStream, $s3params);
@ -148,7 +149,7 @@ trait S3ObjectTrait {
public function objectExists($urn) {
return $this->getConnection()->doesObjectExist($this->bucket, $urn);
}
/**
* S3 copy command with SSE KMS key handling.
*/