better bytes checking

but this still seems like the wrong thing
This commit is contained in:
Mouse Reeve 2020-10-14 09:26:46 -07:00
parent a6d436d05d
commit fe03e95049

View file

@ -38,9 +38,9 @@ def shared_inbox(request):
try: try:
resp = request.body resp = request.body
if isinstance(resp, bytes):
resp = json.loads(resp)
activity = json.loads(resp) activity = json.loads(resp)
if isinstance(resp, str):
resp = json.loads(resp)
activity_object = activity['object'] activity_object = activity['object']
except (json.decoder.JSONDecodeError, KeyError): except (json.decoder.JSONDecodeError, KeyError):
return HttpResponseBadRequest() return HttpResponseBadRequest()