diff options
Diffstat (limited to 'synapse/federation/federation_base.py')
-rw-r--r-- | synapse/federation/federation_base.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/synapse/federation/federation_base.py b/synapse/federation/federation_base.py index 14406f5e70..758512bd86 100644 --- a/synapse/federation/federation_base.py +++ b/synapse/federation/federation_base.py @@ -318,7 +318,7 @@ def event_from_pdu_json(pdu_json, outlier=False): depth = pdu_json['depth'] if not isinstance(depth, six.integer_types): - raise SynapseError(400, "Depth %r not an intger" % (depth, ), + raise SynapseError(400, "Depth %r not an integer" % (depth, ), Codes.BAD_JSON) if depth < 0: @@ -326,6 +326,23 @@ def event_from_pdu_json(pdu_json, outlier=False): elif depth > MAX_DEPTH: raise SynapseError(400, "Depth too large", Codes.BAD_JSON) + if "auth_events" in pdu_json: + pdu_json["auth_events"] = [ + (e, {}) if isinstance(e, six.string_types) else e + for e in pdu_json["auth_events"] + ] + + if "prev_events" in pdu_json: + pdu_json["prev_events"] = [ + (e, {}) if isinstance(e, six.string_types) else e + for e in pdu_json["prev_events"] + ] + + if "origin" not in pdu_json: + pdu_json["origin"] = get_domain_from_id(pdu_json["sender"]) + + logger.info("Unmangled event to: %s", pdu_json) + event = FrozenEvent( pdu_json ) |