From e17befb7d604adfdb811551db456bddc57b8f923 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 10 Oct 2020 23:10:35 +0200 Subject: [PATCH] Use last entry for Content-Type --- src/Network/GuzzleResponse.php | 8 +++++++- src/Util/Images.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Network/GuzzleResponse.php b/src/Network/GuzzleResponse.php index 72d87ae9f..18155d1d2 100644 --- a/src/Network/GuzzleResponse.php +++ b/src/Network/GuzzleResponse.php @@ -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} */ diff --git a/src/Util/Images.php b/src/Util/Images.php index e0375da3d..1b52b91a1 100644 --- a/src/Util/Images.php +++ b/src/Util/Images.php @@ -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