diff options
author | Will Hunt <will@half-shot.uk> | 2021-08-05 13:22:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-05 08:22:14 -0400 |
commit | a8a27b2b8bac2995c3edd20518680366eb543ac9 (patch) | |
tree | 7d20f9684cfc8353fcba9ee50c530a76e9115631 /synapse | |
parent | Add documentation for configuring a forward proxy. (#10443) (diff) | |
download | synapse-a8a27b2b8bac2995c3edd20518680366eb543ac9.tar.xz |
Only return an appservice protocol if it has a service providing it. (#10532)
If there are no services providing a protocol, omit it completely instead of returning an empty dictionary. This fixes a long-standing spec compliance bug.
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/appservice.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index 21a17cd2e8..4ab4046650 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -392,9 +392,6 @@ class ApplicationServicesHandler: protocols[p].append(info) def _merge_instances(infos: List[JsonDict]) -> JsonDict: - if not infos: - return {} - # Merge the 'instances' lists of multiple results, but just take # the other fields from the first as they ought to be identical # copy the result so as not to corrupt the cached one @@ -406,7 +403,9 @@ class ApplicationServicesHandler: 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 protocols[p] + } async def _get_services_for_event( self, event: EventBase |