diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-08-19 07:26:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 07:26:03 -0400 |
commit | eebf52be060876ff14bbcbbc86b64ff9965b3622 (patch) | |
tree | a5c2e61430ff05dbd04e954a234b697acd6b9698 /synapse/replication/tcp | |
parent | Convert runWithConnection to async. (#8121) (diff) | |
download | synapse-eebf52be060876ff14bbcbbc86b64ff9965b3622.tar.xz |
Be stricter about JSON that is accepted by Synapse (#8106)
Diffstat (limited to 'synapse/replication/tcp')
-rw-r--r-- | synapse/replication/tcp/commands.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/synapse/replication/tcp/commands.py b/synapse/replication/tcp/commands.py index d853e4447e..8cd47770c1 100644 --- a/synapse/replication/tcp/commands.py +++ b/synapse/replication/tcp/commands.py @@ -21,9 +21,7 @@ import abc import logging from typing import Tuple, Type -from canonicaljson import json - -from synapse.util import json_encoder as _json_encoder +from synapse.util import json_decoder, json_encoder logger = logging.getLogger(__name__) @@ -125,7 +123,7 @@ class RdataCommand(Command): stream_name, instance_name, None if token == "batch" else int(token), - json.loads(row_json), + json_decoder.decode(row_json), ) def to_line(self): @@ -134,7 +132,7 @@ class RdataCommand(Command): self.stream_name, self.instance_name, str(self.token) if self.token is not None else "batch", - _json_encoder.encode(self.row), + json_encoder.encode(self.row), ) ) @@ -359,7 +357,7 @@ class UserIpCommand(Command): def from_line(cls, line): user_id, jsn = line.split(" ", 1) - access_token, ip, user_agent, device_id, last_seen = json.loads(jsn) + access_token, ip, user_agent, device_id, last_seen = json_decoder.decode(jsn) return cls(user_id, access_token, ip, user_agent, device_id, last_seen) @@ -367,7 +365,7 @@ class UserIpCommand(Command): return ( self.user_id + " " - + _json_encoder.encode( + + json_encoder.encode( ( self.access_token, self.ip, |