Skip to content

Commit 699ed0a

Browse files
committed
Improved favicon API
1 parent 63d5375 commit 699ed0a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

resources/views/components/favicon.blade.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2412,8 +2412,21 @@ function get_headers($url,$format=0)
24122412
}
24132413
24142414
$headers = get_headers($urlICO, 1);
2415+
$headersImage = get_headers($urlICO);
2416+
2417+
foreach ($headersImage as $header) {
2418+
if (stripos($header, 'Content-Type:') === 0) {
2419+
if (stripos($header, 'image/') !== false) {
2420+
$isIco = true;
2421+
} else {
2422+
$isIco = false;
2423+
}
2424+
break;
2425+
}
2426+
}
24152427
2416-
if ($headers[0] == 'HTTP/1.1 200 OK' or $headers[0] == 'HTTP/1.1 301 Moved Permanently') {
2428+
2429+
if (($headers[0] == 'HTTP/1.1 200 OK' or $headers[0] == 'HTTP/1.1 301 Moved Permanently') and $isIco === true) {
24172430
$favicon = $urlICO;
24182431
} else {
24192432
@@ -2445,6 +2458,8 @@ function get_headers($url,$format=0)
24452458
}
24462459
} catch (exception $e) {}
24472460
2461+
$favicon = preg_replace('/([^:])(\/{2,})/', '$1/', $favicon);
2462+
24482463
return $favicon;
24492464
}
24502465

0 commit comments

Comments
 (0)