api: fix possible error in sentry proxy

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-13 16:36:04 +02:00
parent 4895fc3bbb
commit a4b3519428
1 changed files with 4 additions and 1 deletions

View File

@ -51,7 +51,10 @@ class SentryTunnelView(APIView):
return HttpResponse(status=400)
# Body is 2 json objects separated by \n
full_body = request.body
header = loads(full_body.splitlines()[0])
lines = full_body.splitlines()
if len(lines) < 1:
return HttpResponse(status=400)
header = loads(lines[0])
# Check that the DSN is what we expect
dsn = header.get("dsn", "")
if dsn != settings.SENTRY_DSN: