Use last entry for Content-Type
authorPhilipp <admin@philipp.info>
Sat, 10 Oct 2020 21:10:35 +0000 (23:10 +0200)
committerPhilipp <admin@philipp.info>
Sat, 10 Oct 2020 21:11:30 +0000 (23:11 +0200)
src/Network/GuzzleResponse.php
src/Util/Images.php

index 72d87ae..18155d1 100644 (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} */
index e0375da..1b52b91 100644 (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