Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
uhoreg opened this issue May 26, 2017 · 6 comments
Labels
A-Media A-Timeline O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Enhancement Z-Gitter Issues relating to or coming out of the Gitter migration, feature parity, etc

Comments

@uhoreg
Copy link
Member

uhoreg commented May 26, 2017

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.

@turt2live
Copy link
Member

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>

@uhoreg
Copy link
Member Author

uhoreg commented May 27, 2017

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

uhoreg added a commit to uhoreg/matrix-react-sdk that referenced this issue Jul 24, 2017
- allow width, height, alt, title attributes in img (fixes
  element-hq/element-web#4646)
- replace disallowed URL schemes with the title or alt attribute (fixes
  element-hq/element-web#4044)

Signed-off-by: Hubert Chathi <hubert@uhoreg.ca>
uhoreg added a commit to uhoreg/matrix-react-sdk that referenced this issue Jul 24, 2017
- allow width, height, alt, title attributes in img (fixes
  element-hq/element-web#4646)
- replace disallowed URL schemes with the alt or title attribute (fixes
  element-hq/element-web#4044)

Signed-off-by: Hubert Chathi <hubert@uhoreg.ca>
uhoreg added a commit to uhoreg/matrix-react-sdk that referenced this issue Jul 24, 2017
- allow width, height, alt, title attributes in img (fixes
  element-hq/element-web#4646)
- replace disallowed URL schemes with the alt or title attribute (fixes
  element-hq/element-web#4044)

Signed-off-by: Hubert Chathi <hubert@uhoreg.ca>
@g4borg
Copy link

g4borg commented Oct 4, 2018

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?

@t3chguy
Copy link
Member

t3chguy commented Oct 4, 2018

@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
Copy link

bkil commented Sep 21, 2022

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

@Mikaela
Copy link
Contributor

Mikaela commented Sep 21, 2022

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

@MadLittleMods MadLittleMods added A-Timeline S-Minor Impairs non-critical functionality or suitable workarounds exist O-Occasional Affects or can be seen by some users regularly or most users rarely labels Feb 16, 2023
@MadLittleMods MadLittleMods added Z-MadLittleMods Z-Gitter Issues relating to or coming out of the Gitter migration, feature parity, etc and removed P3 labels Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Media A-Timeline O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Enhancement Z-Gitter Issues relating to or coming out of the Gitter migration, feature parity, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants