Merge pull request #2663 from matrix-org/rav/invalid_request_utf8
Fix 500 on invalid utf-8 in request
This commit is contained in:
commit
781c15a6a3
|
@ -167,7 +167,8 @@ def parse_json_value_from_request(request):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
content = simplejson.loads(content_bytes)
|
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)
|
raise SynapseError(400, "Content not JSON.", errcode=Codes.NOT_JSON)
|
||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
Loading…
Reference in New Issue