Hi,
I had an issue with the following link: Le charlatanisme de Galuel | ⊔Foundation
Put on a one-line, it almost imports the whole page. I think this is not a normal behaviour, isn’t it?
A discussion about onebox embeds importing too much content from a target page with malformed HTML. twicedd reported the issue with a specific link and codinghorror recalled seeing this behavior before, attributing it to the target site’s invalid markup.
riking used the W3C validator to identify the errors, including a stray end tag. codinghorror suggested making onebox more tolerant of bad HTML. sam proposed using nokogiri to iron out the bad HTML and truncate it to a sane size.
The issue was eventually fixed by techAPJ via a commit to the onebox repository, and zogstrip confirmed the fix by sharing an updated onebox embed.
Hi,
I had an issue with the following link: Le charlatanisme de Galuel | ⊔Foundation
Put on a one-line, it almost imports the whole page. I think this is not a normal behaviour, isn’t it?
This is indeed really weird, the preview of the onebox is completely different than the cooked version…
We have seen this before, it implies badly invalid markup on the target site which somehow confuses the oneboxer, that is what I recall.
So what should we do about it?
See if the target site passes html validation via the w3c validator, and if not, how many errors does it report?
Error Line 1250, Column 113: Stray end tag a.
…s://fr.wordpress.com/?ref=lof">Build a website with WordPress.com</a></a></div>
Yep, that’ll mess up the document structure.
Not sure how to fix this. Can we make onebox more tolerant of screwed up HTML?
We can, nokogiri can iron out bad html and we can trucate it at some sort of sane size.
@techapj can you add this to your list?
This is now fixed via:
https://github.com/discourse/onebox/commit/1b8bef8f96a4353cdfa6bc67da87d6750d5d31bf
Here’s how it looks now ![]()