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

Images are bridged to IRC as URLs which force a download #257

Open
CyberShadow opened this issue Jul 7, 2023 · 6 comments
Open

Images are bridged to IRC as URLs which force a download #257

CyberShadow opened this issue Jul 7, 2023 · 6 comments

Comments

@CyberShadow
Copy link

CyberShadow commented Jul 7, 2023

Messages with "msgtype": "m.image" are sent to IRC with an URL such as https://matrix.example.com/_matrix/media/r0/download/matrix.org/xxxxxxxxxxxxxxxxxxxxxxxx/image.png. However, Synapse serves these endpoints with Content-Disposition: attachment; filename=image.png. This instructs web browsers to offer to save the image to disk, instead of simply displaying it.

This makes it annoying for IRC users to see images posted by Matrix users.

#227 looks related.

As to how this could be fixed... first, the spec doesn't seem to require any particular Content-Disposition header, nor does it offer any way for clients to request a particular content-disposition. So, Synapse seems to be sending the header on its own volition. Changing this in Synapse might be an option, but another way would be to try to fix this together with #227, which will probably require Heisenbridge to run its own HTTP server. Integrated setups such as https://github.com/spantaleev/matrix-docker-ansible-deploy could simplify setup and configure routes to Heisenbridge's HTTP server without requiring significant effort from users. I see Heisenbridge already uses asynchronous I/O, so maybe throwing in an HTTP server would not be a significant ordeal?

@tulir
Copy link
Collaborator

tulir commented Jul 7, 2023

It's a synapse regression matrix-org/synapse#15885, so I'd hope they fix it there

@signaleleven
Copy link

signaleleven commented Jul 25, 2023

Unfortunately the consensus in matrix-org/synapse#15885 seems to be that the bridge should figure out how to serve content independently :(
It's not a tragedy (and there are workarounds in the link above if your homeserver is behind a proxy that can do some header massaging...) but I agree it's unfortunate.

Just to play with the idea, would there be any other benefit in heisenbridge serving content directly? It's really not a common IRC bouncer use case...

@CyberShadow
Copy link
Author

There is a Synapse PR to revert it for some basic types:
matrix-org/synapse#15988

Just to play with the idea, would there be any other benefit in heisenbridge serving content directly? It's really not a common IRC bouncer use case...

Well, it will need to do that anyway to support encrypted rooms.

@hifi
Copy link
Owner

hifi commented Jul 25, 2023

One fairly easy hack is to run a separate reverse proxy just for Heisenbridge and set its MEDIAURL to the public side of that so that any link it hands out will go through the massaging. I don't think it makes much sense for Heisenbridge itself to serve media.

@joecool1029
Copy link

Looks like this was resolved, I checked after nginx-proxy was ripped from the ansible playbook and I don't hit it anymore. It may have also been fixed by the referenced synapse bug.

@signaleleven
Copy link

I confirm it was fixed before. I also use the ansible playbook, and I have not updated yet (I have traefik in front, but nginx is still behind, so the default config until yesterday).
I don't have the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants