element-hq / element-hq/synapse
Synapse's v2 invites implementation doesn't fallback to v1 on M_UNRECOGNIZED error codes
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#6352](https://github.com/matrix-org/synapse/issues/6352).
---
If Synapse receives a 404 or 400 response on `/_matrix/federation/v2/invite/...`, it only falls back to the v1 API if the error code is `M_UNKNOWN`:
https://github.com/matrix-org/synapse/blob/ace947e8da30c37ead3357abe34adee8a1528296/synapse/federation/federation_client.py#L793-L797
However, `M_UNRECOGNIZED` is another valid code that the server can use if queried on an endpoint it doesn't know about, and in fact that's what Synapse does (i.e. if Synapse gets hit on an endpoint it doesn't implement it'll respond with a 400 status code and the `M_UNRECOGNIZED` error code). It would be compliant with [MSC1794](https://github.com/matrix-org/matrix-doc/blob/master/proposals/1794-federation-v2-invites.md#msc-1794---federation-v2-invite-api) which states that the fallback should happen "If a call to v2 /invite results in an unrecognised request exception AND the room version is 1 or 2" (the check on the room version happens a few lines below the bit of code linked above).
Contributor guide
Assessment
This issue has not been assessed yet.