Ampersand incorrectly encoded in onebox images

Hello,

I’ve noticed that some links aren’t loading on the Discourse I help administer.

This one, for instance:

The same thing happens here, so I’m assuming it is something which some sites are doing differently?

Everything looks fine here:

Any ideas?

It is completely normal and has no errors

That’s weird. When I first wrote the post, the preview didn’t show the image. This is what happens on the Discourse instance I mentioned…

Just that black box.

It’s because the target source image is incorrectly http and your site is https. The image has to be copied over and mirrored locally as https, and this takes time. Not a bug.

If you want to get people to fix it, nag the target site to properly support https…

3 Likes

Thank you, Jeff.

With this URL…

…the broken image has this link:

https://i.guim.co.uk/img/media/00899b988f9403a165de18ce59374793651b0a82/0_2234_3629_2177/master/3629.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=d5b96d8c2dd24b8d6723bba9f91f6724

When I paste that link into the message box I see this:

And the link for that image is:

https://i.guim.co.uk/img/media/00899b988f9403a165de18ce59374793651b0a82/0_2234_3629_2177/master/3629.jpg?width=1200&height=630&quality=85&auto=format&fit=crop&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=d5b96d8c2dd24b8d6723bba9f91f6724

Where are all those '&amp’s coming from in the first link (the image link generated by Onebox, I think…)

Thanks in advance for any insight.

1 Like

Is this related to character encoding?

Ah, maybe you’re right. I’ve definitely seen this behavior with http images, but perhaps the image encoding for the original onebox is incorrect, and somehow corrected once the image is downloaded? I suppose any image with ampersands in the URL would be affected this way, so that’s how to repro… what do you think @techapj?

3 Likes

This one is an example of the behaviour with http images:

This is the broken link:

http://static1.squarespace.com/static/598b5f49d482e97953d22893/t/59f745fdf9619a825c94ab96/1509377632841/22A-wooden-planet-inverted-no-blue-640x360.jpg?format=1500w

Works fine when you change it to https manually:

Discourse is awesome, by the way.

2 Likes

Right that one will also get fixed by local download in a bit.

2 Likes

Mmm, that thumbnail is working now, here, but on the Discourse I’m helping with, it still isn’t showing…

This issue is now fixed via:

https://github.com/discourse/onebox/commit/faa5ef8bee8ffb0b2d032029114b37f819590653

3 Likes

Thank you, @techAPJ. Do I need to do anything to get the update?

Updating to latest version should be enough.

2 Likes