From 75fde1403ab4d33772a0cd76bec65b248aa03a4f Mon Sep 17 00:00:00 2001 From: rosell-dk <17592708+rosell-dk@users.noreply.github.com> Date: Sat, 6 Apr 2024 13:49:18 +0200 Subject: [PATCH] fixed ewww failure due to changed response in ewww --- src/Convert/Converters/Ewww.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Convert/Converters/Ewww.php b/src/Convert/Converters/Ewww.php index 2fc885a..edc5ea2 100644 --- a/src/Convert/Converters/Ewww.php +++ b/src/Convert/Converters/Ewww.php @@ -195,7 +195,8 @@ protected function doActualConvert() // Messages has a http content type of ie 'text/html; charset=UTF-8 // Images has application/octet-stream. // So verify that we got an image back. - if (curl_getinfo($ch, CURLINFO_CONTENT_TYPE) != 'application/octet-stream') { + $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); + if (($contentType != 'application/octet-stream') && ($contentType != 'image/webp')) { //echo curl_getinfo($ch, CURLINFO_CONTENT_TYPE); curl_close($ch); @@ -226,6 +227,8 @@ protected function doActualConvert() throw new ConversionFailedException( 'ewww api did not return an image. It could be that the key is invalid. Response: ' . $response + . ". Content type: " + . curl_getinfo($ch, CURLINFO_CONTENT_TYPE) ); } @@ -282,7 +285,9 @@ public static function keepSubscriptionAlive($source, $key) if (curl_errno($ch)) { return 'curl error' . curl_error($ch); } - if (curl_getinfo($ch, CURLINFO_CONTENT_TYPE) != 'application/octet-stream') { + $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); + if (($contentType != 'application/octet-stream') && ($contentType != 'image/webp')) { + curl_close($ch); /* May return this: {"error":"invalid","t":"exceeded"} */