Images Broken in topic

After some update, I noticed that one of our most important topic has broken images.


In the console log, it says that the server responded with a 404 error

But when I click on the image, it loads just fine.

Can you share the URL to the topic please?

Here it is: [Essentials] How To Post/Format Your Code Correctly - CodeCombat Discourse

Any thoughts @tgxworld?

Bumping OptimizedImage::VERSION is apparently not that safe. This was done recently in

https://github.com/discourse/discourse/commit/570877da3c39707c2101c3510fab1509fb8ba3e2

What happened here is that the user used the following URL in the post:

https://discourse-cdn-sjc1.com/business6/uploads/codecombat/optimized/2X/0/03e091050fe4eed8c0076eee4ab979e171ba14c3_1_690x267.jpg

Note how the optimized image version is included as _1_ in the URL. If I change that to _2_, the image loads properly.

5 Likes

I am not sure I want to fix this… people are not meant to be directly copying these kind of URLs around. We can make a redirect path… I guess… like we do for avatars, but it feels like such an edge case and not a great practice anyway.

6 Likes

It’s fixed. Now if you copy-paste/quote a optimized image in post then it will be converted to proper image markdown with original image URL. I think this will stop 75% optimized image urls usage.

Anyway if you explicitly copied a optimized image url (by right clicking) and used in a post (not html pasting) then it will not get converted. In this case we may need to replace it in cooked post process job. Similar issue will happen to optimized image url oneboxes too.

https://github.com/discourse/discourse/commit/7e4edcfae8a3c0e664b836ee7c5f28b47853a2f8

9 Likes