summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-07-10 14:30:08 -0400
committerGitHub <noreply@github.com>2020-07-10 14:30:08 -0400
commit66a4af8d9627719a875c405c8c0f49b0056811b2 (patch)
tree8b489d82abe00793da78d40715dbb91731224044 /synapse/api
parentAdd types to the server code and remove unused parameter (#7813) (diff)
downloadsynapse-66a4af8d9627719a875c405c8c0f49b0056811b2.tar.xz
Do not use canonicaljson to magically handle decoding bytes from JSON. (#7802)
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/errors.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index 5305038c21..d5d4522336 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -15,13 +15,11 @@
 # limitations under the License.
 
 """Contains exceptions and error codes."""
-
+import json
 import logging
 from http import HTTPStatus
 from typing import Dict, List
 
-from canonicaljson import json
-
 from twisted.web import http
 
 logger = logging.getLogger(__name__)
@@ -573,7 +571,7 @@ class HttpResponseException(CodeMessageException):
         # try to parse the body as json, to get better errcode/msg, but
         # default to M_UNKNOWN with the HTTP status as the error text
         try:
-            j = json.loads(self.response)
+            j = json.loads(self.response.decode("utf-8"))
         except ValueError:
             j = {}