File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,17 @@ export async function fetchFavicon(
4848
4949 // fetch /favicon.ico
5050 {
51- const faviconRes = await fetch (
52- `${ new URL ( siteBaseURL ) . origin } /favicon.ico` ,
53- ) ;
54- const contentType =
55- faviconRes . headers . get ( "content-type" ) ?? "image/vnd.microsoft.icon" ;
56- if ( faviconRes . ok && ! contentType . startsWith ( "text/" ) ) {
51+ const faviconUrl = `${ new URL ( siteBaseURL ) . origin } /favicon.ico` ;
52+ const faviconRes = await fetch ( faviconUrl ) ;
53+ const contentType = faviconRes . headers . get ( "content-type" ) ;
54+ if ( ! contentType )
55+ console . warn (
56+ `header "Content-Type" not found while fetching ${ faviconUrl } ` ,
57+ ) ;
58+ if (
59+ faviconRes . ok &&
60+ ( contentType == null || ! contentType . startsWith ( "text/" ) )
61+ ) {
5762 return base64DataURL (
5863 contentType ,
5964 Buffer . from ( await faviconRes . arrayBuffer ( ) ) ,
You can’t perform that action at this time.
0 commit comments