Merge pull request #2663 from matrix-org/rav/invalid_request_utf8

Fix 500 on invalid utf-8 in request
This commit is contained in:
Richard van der Hoff 2017-11-13 18:35:24 +00:00 committed by GitHub
commit 781c15a6a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,7 +167,8 @@ def parse_json_value_from_request(request):
try:
content = simplejson.loads(content_bytes)
except simplejson.JSONDecodeError:
except Exception as e:
logger.warn("Unable to parse JSON: %s", e)
raise SynapseError(400, "Content not JSON.", errcode=Codes.NOT_JSON)
return content