element-hq/element-web

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

Opened this issue ยท 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.

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>

Plot twist: dog.png is actually a picture of a squid. ๐Ÿ˜‰

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 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

bkil commented

@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.

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