summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-05 18:12:44 +0100
committerErik Johnston <erik@matrix.org>2015-05-05 18:12:53 +0100
commit977338a7afa5e95dba1ce230ba253daf2b239fb5 (patch)
treee74002bfb6830d154331ec4f726949db99935c39 /synapse
parentMerge pull request #139 from matrix-org/bugs/SYN-369 (diff)
downloadsynapse-977338a7afa5e95dba1ce230ba253daf2b239fb5.tar.xz
Use buffer(...) when inserting into bytea column
Diffstat (limited to 'synapse')
-rw-r--r--synapse/federation/persistence.py4
-rw-r--r--synapse/storage/transactions.py3
2 files changed, 3 insertions, 4 deletions
diff --git a/synapse/federation/persistence.py b/synapse/federation/persistence.py
index 76a9dcd777..865766eb2c 100644
--- a/synapse/federation/persistence.py
+++ b/synapse/federation/persistence.py
@@ -23,8 +23,6 @@ from twisted.internet import defer
 
 from synapse.util.logutils import log_function
 
-from syutil.jsonutil import encode_canonical_json
-
 import logging
 
 
@@ -71,7 +69,7 @@ class TransactionActions(object):
             transaction.transaction_id,
             transaction.origin,
             code,
-            encode_canonical_json(response)
+            response,
         )
 
     @defer.inlineCallbacks
diff --git a/synapse/storage/transactions.py b/synapse/storage/transactions.py
index 89dd7d8947..b5b21a9b13 100644
--- a/synapse/storage/transactions.py
+++ b/synapse/storage/transactions.py
@@ -17,6 +17,7 @@ from ._base import SQLBaseStore, cached
 
 from collections import namedtuple
 
+from syutil.jsonutil import encode_canonical_json
 import logging
 
 logger = logging.getLogger(__name__)
@@ -82,7 +83,7 @@ class TransactionStore(SQLBaseStore):
                 "transaction_id": transaction_id,
                 "origin": origin,
                 "response_code": code,
-                "response_json": response_dict,
+                "response_json": buffer(encode_canonical_json(response_dict)),
             },
             or_ignore=True,
             desc="set_received_txn_response",