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

Room previews using the room summary API from MSC3266 fail for remote rooms #3395

Closed
marwing opened this issue May 9, 2024 · 1 comment · Fixed by #3407
Closed

Room previews using the room summary API from MSC3266 fail for remote rooms #3395

marwing opened this issue May 9, 2024 · 1 comment · Fixed by #3407
Assignees

Comments

@marwing
Copy link

marwing commented May 9, 2024

I noticed this when trying the new room permalink support in Element X iOS.

When requesting the room summary for a room that isn't in the room directory, the SDK tries the MSC3266 room summary endpoint next.
For example, when opening the URL https://matrix.to/#/#matrix:matrix.org, the following request reaches my server:

GET /_matrix/client/unstable/im.nheko.summary/rooms/!OGEhHVWSdvArJzumhm:matrix.org/summary

Notice the absence of via URL parameters. This results in an error on the client and synapse complaining in the logs:

SynapseError: 400 - Missing via to query remote room

and returning:

{"errcode":"M_UNKNOWN","error":"Missing via to query remote room"}

The SDK then falls back to /state and /joined_members which fail because my server doesn't know the room.

This results in unavailable room previews for rooms that my server doesn't know about, aka remote rooms. For a single-user homeserver, this affects virtually all rooms since, if I'm not already in the room, my server likely doesn't know about it.

matrix.to uses the same API, however when telling it to use my server the summary call works and I can view room details. The API request differs in two interesting ways:

GET /_matrix/client/unstable/im.nheko.summary/rooms/%23matrix%3Amatrix.org/summary?via=matrix.org&_cacheBuster=1365069511896160
  1. The summary API is called with the room alias from the permalink instead of the room id, and
  2. via parameters are added, in this case from the server name in the alias.

Either of which is apparently enough to get the expected result from the API (based on manual testing).

A similar problem happens for permalinks already containing via parameters, where the parameters are not passed on. For example, https://matrix.to/#/!OGEhHVWSdvArJzumhm:matrix.org?via=matrix.org&via=wolfo.tech&via=blob.cat results in the same API request and the same synapse error.

The relevant code was introduced in #3339, which only passes the room id to ruma:

pub async fn from_room_summary(client: &Client, room_id: &RoomId) -> crate::Result<Self> {
let request = ruma::api::client::room::get_summary::msc3266::Request::new(
room_id.to_owned().into(),
Vec::new(),
);

@bnjbvr bnjbvr self-assigned this May 13, 2024
@bnjbvr
Copy link
Member

bnjbvr commented May 13, 2024

Thanks for the report! Indeed, the via parameters are not forwarded at the moment, not even sure the FFI layer includes the parameter, so I'll add that.

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