Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 380c3d4

Browse files
authored
Return JSON errors for unknown resources under /matrix/client. (#11930)
Re-applies the changes from 3e0cfd4 (#11602), reverting d93ec0a (#11764) now that the conflict with the webclient listener was fixed in 119edf5 (#11895).
1 parent 3655585 commit 380c3d4

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

changelog.d/11930.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a long-standing bug that some unknown endpoints would return HTML error pages instead of JSON `M_UNRECOGNIZED` errors.

synapse/app/homeserver.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import synapse.config.logger
2727
from synapse import events
2828
from synapse.api.urls import (
29+
CLIENT_API_PREFIX,
2930
FEDERATION_PREFIX,
3031
LEGACY_MEDIA_PREFIX,
3132
MEDIA_R0_PREFIX,
@@ -195,13 +196,7 @@ def _configure_named_resource(
195196

196197
resources.update(
197198
{
198-
"/_matrix/client/api/v1": client_resource,
199-
"/_matrix/client/r0": client_resource,
200-
"/_matrix/client/v1": client_resource,
201-
"/_matrix/client/v3": client_resource,
202-
"/_matrix/client/unstable": client_resource,
203-
"/_matrix/client/v2_alpha": client_resource,
204-
"/_matrix/client/versions": client_resource,
199+
CLIENT_API_PREFIX: client_resource,
205200
"/.well-known": well_known_resource(self),
206201
"/_synapse/admin": AdminRestResource(self),
207202
**build_synapse_client_resource_tree(self),

0 commit comments

Comments
 (0)