Image caching modifies code blocks

Hello, I have encountered a bug with the DevForum’s caching system which modifies the source of images to the DevForum’s cache in HTML code blocks.

I first experienced the bug on 2023-12-01T23:00:00Z

Example

2 Likes

This is just how Discourse reuploads the image in their server. there’s no problem or bug here

1 Like

i know. the issue is that it also does that for code explicitly not meant to be changed

Please acknowledge this, this is dumb oversight that is easily fixable.

Hi, what’s the impact of this issue? Can you point to multiple real examples of posting behavior in the past where this has caused issues for you?

Hello,
sorry for the delay I hadn’t seen that you replied.
Anyways, here is a post where this bug affects me. It occurs in the HTML code blocks explaining how to get cool badges.

This seems correct no? There’s no point leaving the reference unedited, since you wouldn’t be able to re-post that anyway outside of the code block without the file being image cached anyway.

The purpose of a code block is to show the code, to explain it, which is not possible if caching changes references. Especially if you’re trying to explain how to properly reference a badge.
What if in a hell-like alternate universe, references in Luau code blocks were cached? It would be hell.

Also the caching breaks the icons at the left if the badges, but I think it’s better if I make another bug report.

Does the caching occur when you only have the link in the code block? Or only when the link is both embedded in the post and included in the code block?

going to test it

<img src="upload://ec9TmLkGplcPGuAhzN1NSaippqC.jpeg">
<img src="https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg">

Uhhh it seems like it’s not happening anymore.
EDIT: yes it did it just needed a bit of time

It looks like it did auto-replace your image in code block, but only when the image is also in the post outside of the code block.

In the mean-time, you can probably just modify back the code block with the old link after it has been replaced. I understand this isn’t a great solution but we probably can’t prioritize this soon due to what’s already on our plate vs. this being a low impact issue that doesn’t occur frequently.

Btw, I am still not sure if there is a valid use case where this matters on the forum, considering we don’t allow embedding of third-party dynamic content anyway.

1 Like

When I change the link, it changes back to the cached one.

Also, shields.io isn’t dynamic content as far as I know. There are options for dynamic badges, but I don’t use them.

A use case that would matter on the forum is showing off code, and what the code does, in the same post.
And it can’t be that hard to fix, just add a check verifying a link is not a in code block before caching it.

To be clear when I’m talking about “dynamic” content I mean content that isn’t hosted on this forum or on a list of allow-listed domains.

We don’t own the source code (we use Discourse to run this forum) so any changes required to the original source code makes it a more lengthy and complicated process hence impacts how we prioritize issues, thanks for understanding.

1 Like