Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
Fix crash when body is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Jun 14, 2017
1 parent 7a4587e commit 0dd4c4b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kinto_elasticsearch/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ def search_view(request, **kwargs):
# If the size is specified in query, ignore it if larger than setting.
specified = None
if "body" in kwargs:
body = json.loads(kwargs["body"].decode("utf-8"))
specified = body.get("size")
try:
body = json.loads(kwargs["body"].decode("utf-8"))
specified = body.get("size")
except json.decoder.JSONDecodeError:
pass
if specified is None or specified > configured:
kwargs.setdefault("size", configured)

Expand Down

0 comments on commit 0dd4c4b

Please sign in to comment.