Repository navigation
fix: support domainless room ids of room version 12 - #234
Conversation
|
Thank you for the contribution! For reference: Related to #210. Personal notes:On Debian 13 GNOME HP laptop: matrix_commander/matrix-commander --versionOutput:uv venvOutput:source .venv/bin/activate
uv pip install -r requirements.txt Output:matrix_commander/matrix-commander --message testOutput:matrix_commander/matrix-commander --message zeroOutput:matrix_commander/matrix-commander --message zero --room '!reYX21hc5ApdqBuAZ6cMLMlLcWlLPnKxUtFGLFc2qN4'Output:Default Element desktop Matrix.org room version is now 12. matrix_commander/matrix-commander --room-join '!reYX21hc5ApdqBuAZ6cMLMlLcWlLPnKxUtFGLFc2qN4'Output:matrix_commander/matrix-commander --room-joinOutput:Even after the proposed changes. matrix_commander/matrix-commander --room-join '!reYX21hc5ApdqBuAZ6cMLMlLcWlLPnKxUtFGLFc2qN4' --debugOutput:If replace: if ri not in client.rooms:with: if False:matrix_commander/matrix-commander --room-join '!reYX21hc5ApdqBuAZ6cMLMlLcWlLPnKxUtFGLFc2qN4' --debugOutput:matrix_commander/matrix-commander --message zero --room '!reYX21hc5ApdqBuAZ6cMLMlLcWlLPnKxUtFGLFc2qN4'Output:file ~/.local/share/matrix-commander/store/\@benjamin_loison_work\:matrix.org_JKRYMHTBVW.db Output:tree -a ~/.local/share/matrix-commander/Output:I quickly browsed the SQL database without finding anything relevant to change the default room. Searching issues for default, only returns relevantly 8go/matrix-commander/issues/150, which does not help. Line 234 in da51ac2 ls -lha ~/.config/matrix-commander/Output:jq . ~/.config/matrix-commander/credentials.json Output:{
"homeserver": "https://matrix.org",
"device_id": "JKRYMHTBVW",
"user_id": "@benjamin_loison_work:matrix.org",
"room_id": "!pdsVekCwcOiaJoleKk:matrix.org",
"access_token": "XXX_XXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXXXXXX_XXXXXX"
}After changing default room to V12, it still works fine. matrix_commander/matrix-commander --message oneOutput: |
| # '!someRoomId' | ||
| ri = ri + ":" + default_homeserver(gs.credentials) | ||
| # '!someRoomId'; keep room v12 domainless ids as is | ||
| if ri not in client.rooms: |
There was a problem hiding this comment.
This condition breaks --room-join, do you have an idea how to solve this issue?
Room ids are opaque values per spec: room version 12 (MSC4291) generates ids without the ':domain' suffix. map_roominfo_to_roomid() unconditionally appended the homeserver domain to any '!id' without a colon, which broke send and join for v12 rooms (E151 send / E129 join "No known servers"). An incomplete legacy id cannot be told apart from a complete domainless v12 id, so never append a domain suffix and use the id exactly as provided. Aliases are still resolved via the homeserver. Fixes 8go#210
baec417 to
fa5b59d
Compare
|
I am doubtful, but have not investigated enough to be sure, that new changes does not let the ability to specify a room before V12 without specifying the domain, but it looks more like a shortcut, than current blocking missing V12 support, so let us merge and investigate further if someone wants the shortcut if the shortcut has an issue. could help filter domain add. |
Problem
On homeservers where rooms are created with room version 12 (domainless room ids, no
:domainsuffix), every send fails:--joined-roomsreturns bare ids like!qLztd..., but--room '!qLztd...' --message ...fails.Domainless room ids are part of room version 12 — see
RoomVersionV12in gomatrixserverlib: registered withdomainlessRoomID: trueand the comment "v3 versions relax the room ID check as the room ID has no domain now".Root cause
map_roominfo_to_roomid()treats any!idwithout a colon as a "short" room id and unconditionally appends:<domain>. Since v12 room ids legitimately have no domain part, the resulting id matches no known room.Fix
Only append the domain suffix when the bare id is not already present in
client.rooms.Testing
matrix-commander 8.0.6 against a homeserver with default room version 12: E151 before,
--message/--tail/--joined-roomsworking after. Standard servers unaffected: bare ids never appear inclient.roomsthere, so suffixing behavior is unchanged.