mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-05 10:54:14 -04:00
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.
This commit is contained in:
parent
834cdc3606
commit
a8a27b2b8b
3 changed files with 125 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue