From 1cc4a3df04cdb1d15f3ed14c67f84bcbb21ae83b Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 4 Aug 2021 14:19:54 +0100 Subject: [PATCH] Check that a appservice protocol has at least one service --- changelog.d/10532.bugfix | 1 + synapse/handlers/appservice.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog.d/10532.bugfix diff --git a/changelog.d/10532.bugfix b/changelog.d/10532.bugfix new file mode 100644 index 000000000000..5cea4bbbcaa2 --- /dev/null +++ b/changelog.d/10532.bugfix @@ -0,0 +1 @@ +Only report protocols that are implemented by at least one service, as required by the spec when handling `GET /_matrix/client/r0/thirdparty/protocols`. \ No newline at end of file diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index 21a17cd2e834..7ab558912eab 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -406,7 +406,11 @@ def _merge_instances(infos: List[JsonDict]) -> JsonDict: return combined - return {p: _merge_instances(protocols[p]) for p in protocols.keys()} + return { + p: _merge_instances(protocols[p]) + for p in protocols.keys() + if len(protocols[p]) > 0 + } async def _get_services_for_event( self, event: EventBase