Handling of broken onebox images from malconfigured sites

I see quite a lot of misconfigured sites that look to use various methods to block ‘hot’ linking of images, but return links to such images in the embedding data e.g.

Checking with http://debug.iframely.com/ I really think this isn’t a Discourse problem per se, but it does look poor.

One thought is that the onebox creation could retrieve the image when cooking the post and either store a thumbnail to serve later, or if it couldn’t be retrieved act as though there was no image specified.

Storing a copy of the image would be fairly robust and future-proof, and I think should fall under fair-use for copyright purposes (the original site isn’t going to be worse-off for the reuse of a 130x90 thumbnail which was retrieved from meta-data, though IANAL).

Failing that I tried making a component to catch the error event on images and then add a class to display:none them or their wrapper. I’ve not succeeded yet as I got bogged down in decorateCookedElement()… I’m not sure if I’m looking in the right place.

So, is it just me that seems to suffer broken images frequently in oneboxes - has anyone else got a workaround?

Don’t we already do that? Check your post again!

It’s obviously not at cook time, because you don’t put web requests on that critical path, but we queue it and download the onebox image in the background.

We wait editing grace period (default 300s) to download it if download remote images to local (default true).

4 Likes

Fantastic!

I was looking under one box settings, so hadn’t seen ‘download remote images to local’, which had been disabled.

I’ve enabled it and rebuilt html on some posts. Hopefully this will tidy some things up.

Thank you for the pointer :heart:

2 Likes

Thank you!

I was just asking about this in another topic.

1 Like

It’s important to be careful and ponder the repercussion when changing the default settings. We ship with optimal choices out of the box, and deviating from those can have unintended consequences .

1 Like

That’s a fair point. Generally I stick to defaults, but in this case it looks like the setting was changed by a previous admin - I’m not sure why.

Hopefully this setting will make the images in Instagram oneboxes persist now too.

Thank you again & much love to Discourse :heart:

2 Likes

Yeah, onebox has much better feedback now when it can’t onebox, it tries its best to explain why.

1 Like