mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 23:10:20 +00:00
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
1 changed files with 2 additions and 1 deletions
|
@ -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 a new issue