Use last entry for Content-Type

This commit is contained in:
Philipp 2020-10-10 23:10:35 +02:00
parent 8c7185154d
commit e17befb7d6
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
2 changed files with 8 additions and 2 deletions

View file

@ -88,7 +88,13 @@ class GuzzleResponse extends Response implements IHTTPResult, ResponseInterface
/** {@inheritDoc} */
public function getContentType()
{
return implode($this->getHeader('Content-Type'));
$contentTypes = $this->getHeader('Content-Type') ?? [];
$countTypes = count($contentTypes);
if ($countTypes > 0) {
return $contentTypes[$countTypes - 1];
} else {
return '';
}
}
/** {@inheritDoc} */

View file

@ -77,7 +77,7 @@ class Images
*
* @param string $image_data Image data
* @param string $filename File name (for guessing the type via the extension)
* @param string $mimeTypes possible mime type
* @param string $mimeType possible mime type
*
* @return string
* @throws \Exception