Skip to content

Commit

Permalink
fixed ewww failure due to changed response in ewww
Browse files Browse the repository at this point in the history
  • Loading branch information
rosell-dk committed Apr 6, 2024
1 parent f9e64ac commit 75fde14
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Convert/Converters/Ewww.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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)
);
}

Expand Down Expand Up @@ -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"} */
Expand Down

0 comments on commit 75fde14

Please sign in to comment.