diff --git a/src/api/wishes.php b/src/api/wishes.php index b1d77b14..d4b5c4d7 100644 --- a/src/api/wishes.php +++ b/src/api/wishes.php @@ -35,7 +35,7 @@ switch ($_SERVER['REQUEST_METHOD']) { if (isset($info->url) && $info->url) { $code = URL::getResponseCode($info->url); - if (200 !== $code) { + if ($code < 200 || $code >= 400) { $info->url = $url; } } @@ -87,7 +87,7 @@ switch ($_SERVER['REQUEST_METHOD']) { if (!empty($info->image)) { $codeImage = URL::getResponseCode($info->image); - if (200 === $codeImage) { + if ($codeImage >= 200 && $codeImage < 400) { $wish_image = '"' . $info->image . '"'; } } @@ -156,7 +156,7 @@ switch ($_SERVER['REQUEST_METHOD']) { if (!empty($info->image)) { $codeImage = URL::getResponseCode($info->image); - if (200 === $codeImage) { + if ($codeImage >= 200 && $codeImage < 400) { $wish_image = '"' . $info->image . '"'; } } diff --git a/src/classes/cache/embed.php b/src/classes/cache/embed.php index a3dc6b9b..37e875aa 100644 --- a/src/classes/cache/embed.php +++ b/src/classes/cache/embed.php @@ -101,13 +101,13 @@ class Embed extends Cache curl_close($ch); - $info->favicon = $favicon && 200 === $code ? 'data:image/x-icon;base64,' . base64_encode($favicon) : ''; + $info->favicon = $favicon && ($code >= 200 && $code < 400) ? 'data:image/x-icon;base64,' . base64_encode($favicon) : ''; } /** URL */ $codeURL = \wishthis\URL::getResponseCode($info->url); - if (200 !== $codeURL) { + if ($codeURL < 200 || $codeURL >= 400) { $generateCache = false; } }