Merge pull request #230 from mouse-reeve/bytes

Received bytes, expecting a string
This commit is contained in:
Mouse Reeve 2020-10-06 12:36:33 -07:00 committed by GitHub
commit 1705a550d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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