From 6296590bf7fb4a8f43755d29ecb8a4819310e25d Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 16 Oct 2015 10:50:32 +0100 Subject: [PATCH] Encode the filter JSON as UTF-8 before storing in the database. Because we are using a binary column type to store the filter JSON. --- synapse/storage/filtering.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synapse/storage/filtering.py b/synapse/storage/filtering.py index 880011657..700da8d8c 100644 --- a/synapse/storage/filtering.py +++ b/synapse/storage/filtering.py @@ -34,10 +34,10 @@ class FilteringStore(SQLBaseStore): desc="get_user_filter", ) - defer.returnValue(json.loads(def_json)) + defer.returnValue(json.loads(def_json.decode("utf-8"))) def add_user_filter(self, user_localpart, user_filter): - def_json = json.dumps(user_filter) + def_json = json.dumps(user_filter).encode("utf-8") # Need an atomic transaction to SELECT the maximal ID so far then # INSERT a new one