Onebox try to fetch favicon with relative URL instead of absolute URL

AI-generated summary

The discussion revolves around an issue where Discourse attempts to fetch a favicon using a relative URL instead of an absolute one, causing broken icons in oneboxes. ashledombos reports that despite having an absolute favicon URL in the page source, Discourse incorrectly constructs the URL relative to the post URL. eviltrout asks for clarification, while techAPJ acknowledges the issue and investigates. Later, techAPJ notes they can no longer reproduce the problem. ashledombos speculates that the issue might stem from Discourse pulling favicon data from an outdated template on the root page rather than the specific page being linked, suggesting a potential caching or template rendering issue.

Hello,

It try to fix a strange behavior, when I copy a link from a site I manage, the one box is appearing, but the favicon url is not correct, as an example:

The favicon URL of the site is https://www.openmandriva.org/squelettes/icons/favicon-32x32.png (I even put the absolute URL in the head) as it can be seen in the source.

But Discourse try to fetch a favicon relative to the post URL, ie https://www.openmandriva.org/it/notizie/article/la-migliore-di-sempre-rilasciata-omlx-4-0/squelettes/icons/favicon-32x32.png, and as a result, the link is broken.

What should I do to fix it?

I don’t see a favicon in that example. Can you provide an example with a broken favicon?

Looks like we are removing the broken favicon image when post processing. I can repro the issue in composer preview. Will investigate and fix.

I can not reproduce the broken favicon anymore here on meta or on my dev instance. Did you fix something on your end @ashledombos?

I did not touch anything, that’s really weird because here above also the icon appears in onebox :hushed:

Edit: In fact I maybe get an idea, but I don’t know if it’s a start of an explanation: I changed the generic template in order to have favicon absolute URLs in heads, and forced this particular page to update the template, but not other pages (which were to be updated later depending on their cache expiry)… Maybe discourse get the favicon information from the non updated landing (root) page source and not from the pasted URL source itself?