diff options
author | Erik Johnston <erik@matrix.org> | 2020-09-16 12:42:42 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2020-09-16 12:42:42 +0100 |
commit | 9c8ef134fec6295903d3e268e9a34dff530d92e8 (patch) | |
tree | 2e0984df14664e81f4553cfcb42db0b1592ee6cd | |
parent | Clarify changelog. (diff) | |
parent | Newsfile (diff) | |
download | synapse-9c8ef134fec6295903d3e268e9a34dff530d92e8.tar.xz |
Merge branch 'erikj/fix_origin_check' into release-v1.20.0
-rw-r--r-- | changelog.d/8324.bugfix | 1 | ||||
-rw-r--r-- | synapse/federation/federation_client.py | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/changelog.d/8324.bugfix b/changelog.d/8324.bugfix new file mode 100644 index 0000000000..32788a9284 --- /dev/null +++ b/changelog.d/8324.bugfix @@ -0,0 +1 @@ +Fix fetching events from remote servers that are malformed. diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py index 38ac7ec699..a2e8d96ea2 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py @@ -54,7 +54,7 @@ from synapse.events import EventBase, builder from synapse.federation.federation_base import FederationBase, event_from_pdu_json from synapse.logging.context import make_deferred_yieldable, preserve_fn from synapse.logging.utils import log_function -from synapse.types import JsonDict +from synapse.types import JsonDict, get_domain_from_id from synapse.util import unwrapFirstError from synapse.util.caches.expiringcache import ExpiringCache from synapse.util.retryutils import NotRetryingDestination @@ -386,10 +386,11 @@ class FederationClient(FederationBase): pdu.event_id, allow_rejected=True, allow_none=True ) - if not res and pdu.origin != origin: + pdu_origin = get_domain_from_id(pdu.sender) + if not res and pdu_origin != origin: try: res = await self.get_pdu( - destinations=[pdu.origin], + destinations=[pdu_origin], event_id=pdu.event_id, room_version=room_version, outlier=outlier, |