Code block image link gets modified when hotlinked image is downloaded

It happens when using the ![](http://something.com/image.jpg) Markdown convention in a code block and then using the same code outside of the code block to actually display the image. It happens after about 5 minutes once Discourse downloads the hotlinked image.


![](upload://AsSrl1gma2TCpFn39yVdqjy9YTt.jpeg)


Original:

image

5 Likes

For the record, I faced the issue when trying to illustrate this:

To circumvent the problem, I used հ (armenian small letter ho) instead of h (latin small letter h) in the https part. Since they are recognized as different characters, it doesn’t trigger the URL replacement.

Thanks to Unicode Utilities: Confusables

3 Likes

:100: great description. Our logic skips detecting images in a codeblock. But if there is a real image somewhere with exactly-identical markdown, then our actual find/replace code isn’t robust enough to avoid the codeblocks.

It’s not going to be trivial to fix, but for now I’ve added some failing tests so that we’re tracking the issue:

3 Likes