Whoops issue with favicons

I’ve run into a strange issue with hits to favicons. They throw a Kirby error.

If i try to hit http://domain.dev/assets/images/favicon/apple-touch-icon.png it throws a whoops page.

This line in one of my snippets is causing an error:

$bannercontent = $page->site()->index()->findBy('uid', $currentpage)->pageintro();

The thing is… this is a direct file access. It should not even be looking at at the templates and snippets.

Its bascially a vanilla .htacess file. All ive really done is added rules for Gzip to the standard rules that come with Kirby. The issue persists even with the vanilla Kirby .htaccess.

I should be able to directly hit an image file, surely??

Anyone got any ideas?

Would be helpful to know what the error is?

Oh, sorry…

Call to a member function pageintro() on boolean

But why is it even processing a snippet?? It doesnt need to, its a direct hit to image. Im lost.

What do you mean by “a direct hit to an image”? Where? What code? If the snippet wasn’t called and just lived quietly in its folder, it wouldn’t throw an error.

I have favicon code in my page head like this:

<link rel="apple-touch-icon" sizes="180x180" href="/assets/images/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/images/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/images/favicon/favicon-16x16.png">
<link rel="manifest" href="/assets/images/favicon/manifest.json">
<link rel="mask-icon" href="/assets/images/favicon/safari-pinned-tab.svg" color="#002a5c">
<link rel="shortcut icon" href="/assets/images/favicon/favicon.ico">
<meta name="msapplication-TileColor" content="#002a5c">
<meta name="msapplication-TileImage" content="/assets/images/favicon/mstile-144x144.png">
<meta name="msapplication-config" content="/assets/images/favicon/browserconfig.xml">

I cannot directly access any of those files in a browser, not even images, because it throws a whoops page.

they are all in /assets/images/favicon/ so i thnk something in Kirbies .htaccess files or somewhere else is restricting access to only certain folders under the assets folder.

But it seems to be treating it like a page and trying to process a template for the file, which is breaking it.

Are you using any routes? Or plugins with routes maybe?

I haven’t set any routes. The site is using the following plugins:

And the site as such works without any problems?

No other issues at all. In fact, the site is almost finished. I stumbled on this issue during some final jobs.

I can’t reproduce this issue; I have several sites on localhost and remote with such a favicons folder and no problem at all. Could you please post the complete error message and your .htaccess file? Do you get the same issue with a fresh starter kit (and those favicons) on that server?

Hmmm thats odd. Now i have rebooted the server and come back to work this morning, it seems to be working. Very strange. However, i do still get a whoops page if i hit a file that doesn’t exist. Shouldn’t this use the sites error page instead? The one in my templates?

Yes, if the image does not exist, the error page should be called.

What does your Whoops page tell you?