]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Raise HTTP 422 if the submission doesn't parse. elo-categories
authorAnt Zucaro <azucaro@gmail.com>
Sat, 22 Apr 2017 19:50:48 +0000 (15:50 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sat, 22 Apr 2017 19:50:48 +0000 (15:50 -0400)
xonstat/views/submission.py

index a3bd3e3d044e32af84b014b66e1435a274575042..e0ada1cc5bde5e4d3841243b0c8632deba2b0a4e 100644 (file)
@@ -1056,7 +1056,15 @@ def submit_stats(request):
                   "----- END REQUEST BODY -----\n\n")
 
         (idfp, status) = verify_request(request)
-        submission = Submission(request.body, request.headers)
+        try:
+            submission = Submission(request.body, request.headers)
+        except:
+            msg = "Invalid submission"
+            log.debug(msg)
+            raise pyramid.httpexceptions.HTTPUnprocessableEntity(
+                body=msg,
+                content_type="text/plain"
+            )
 
         do_precondition_checks(request.registry.settings, submission)