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

Commit

Permalink
Partially revert #11602 to prevent webclient overriding client resource
Browse files Browse the repository at this point in the history
known client resource prefixes under one, simplified '/_matrix/client'
prefix. Unfortunately, '/_matrix/client' is already a prefix used by the
'webclient' resource. As we use a Python dictionary to hold a mapping
from prefix to resource, configuring a 'webclient' resource after a
'client' resource would end up with all client requests being redirected
to the webclient resource (which doesn't know how to handle things like
/login or /sync).

Reverting #11602 fixes the bug while maintaining JSON responses as the
PR intended. However, this bug has highlighted how fragile the resource code
is currently.
  • Loading branch information
anoadragon453 committed Jan 18, 2022
1 parent 4ec0a30 commit 98ff028
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import synapse.config.logger
from synapse import events
from synapse.api.urls import (
CLIENT_API_PREFIX,
FEDERATION_PREFIX,
LEGACY_MEDIA_PREFIX,
MEDIA_R0_PREFIX,
Expand Down Expand Up @@ -193,7 +192,13 @@ def _configure_named_resource(

resources.update(
{
CLIENT_API_PREFIX: client_resource,
"/_matrix/client/api/v1": client_resource,
"/_matrix/client/r0": client_resource,
"/_matrix/client/v1": client_resource,
"/_matrix/client/v3": client_resource,
"/_matrix/client/unstable": client_resource,
"/_matrix/client/v2_alpha": client_resource,
"/_matrix/client/versions": client_resource,
"/.well-known": well_known_resource(self),
"/_synapse/admin": AdminRestResource(self),
**build_synapse_client_resource_tree(self),
Expand Down

0 comments on commit 98ff028

Please sign in to comment.