element-web icon indicating copy to clipboard operation
element-web copied to clipboard

replace external images with alt text instead of completely stripping them out

Open uhoreg opened this issue 7 years ago • 6 comments

The message shown below includes an <IMG> element with an alt attribute pointing to a non-MXC image. image Since it is a non-MXC image, Riot strips out the image, but it would be nice to replace it with the alt text instead, since that is provided.

uhoreg avatar May 26 '17 19:05 uhoreg

Instead of the alt text, could it just drop the src in place?

Otherwise this would be a bit weird: <span>I am a <img src="dog.png" alt="human"></span>

turt2live avatar May 26 '17 19:05 turt2live

Plot twist: dog.png is actually a picture of a squid. 😉

uhoreg avatar May 27 '17 14:05 uhoreg

imho at least docs should mention this behaviour, I personally found it very strange, that images just disappear out of markdown texts, and even used a mattermost instance just to double check if my syntax was at fault. Nowhere in the matrix docs nor riot docs I found out whether img tags from normal urls are supported, or if all images have to be mxc resources.

Also I would love to disable it, personally.

I guess this has to do with encryption?

g4borg avatar Oct 04 '18 10:10 g4borg

@g4borg primarily privacy and availability, if I could make everyone's client load any image url, then I could post an image hosted on my own server and instantly have everyone's IP Address who was active in the room at the time that loaded the image. Availability such that if the image refers to a server which later goes down it'd be unavailable, whereas this is less likely to happen with a purpose-built federated media repository as is used via the mxc:// urls

t3chguy avatar Oct 04 '18 11:10 t3chguy

@lukebarnard1 This issue is still valid. It also occurs when you disable displaying images within your client. In this case, the sanitizer also strips off all tags and leaves a bare <img>. While if it left metadata attributes such as width, height, alt and title, the client could show a placeholder and text.

It is also starting to feel more important as sending custom reactji pastes in an <img>, so the conversation will seem less and less legitimate the less Unicode reactji participants are using.

bkil avatar Sep 21 '22 17:09 bkil

I understand the previous comment to be referring to https://github.com/matrix-org/matrix-spec-proposals/pull/2545 which is implemented by FluffyChat, Nheko and Cinny.

Mikaela avatar Sep 21 '22 20:09 Mikaela