Turn off image links validation?

Hi guys, I’m having issues with the cooked content of posts with images.

The thing is that we are using a custom link for images looking like:

Everything good when the post is created, but there’s a point while discourse is cooking that post html, that detects that this link is “broken”, so it replaces it’s content with a <span> like the following:

<span class="broken-image" title="This image is broken">
<svg class="fa d-icon d-icon-unlink svg-icon" aria-hidden="true"><use xlink:href="#unlink"></use></svg>

This is not happening on file uploads, so I’m wondering if there’s a way to disable this validation to keep cooked version intact?

Have you enabled the block hotlinked media setting?

I don’t, and I can’t find that setting in the UI, is there a special place to look for it?

Looking on this thread I see there’s a block_hotlinked_media feature but I don’t really have that set.

Can you share your Discourse version exactly?

It’s unlikely – is there a chance your image domain prevents hotlinked images?

Sounds like it, I’m aware we are using an old version 2.4.0.beta6, we have plans to upgrade, but not just yet.

These image tags look like:

<img src="/api/v1/discourse/custom/link/hash_id/filename.png" width="452" height="409">

The solution to this issue was to include the hostname for the image, to have the full link. That way, even if discourse doesn’t have access to the resourse, it is not messing with img elements in the cooked version.

@Arkshine I appreciate your help.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.