diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 129: handle invalid values for start in job_output (which googlebot likes to provide)

Message ID 20120209204609.27530.44881.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Feb. 9, 2012, 8:46 p.m. UTC
------------------------------------------------------------
revno: 129
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Thu 2012-02-09 12:44:59 -0800
message:
  handle invalid values for start in job_output (which googlebot likes to provide)
modified:
  lava_scheduler_app/views.py


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_scheduler_app/views.py'
--- lava_scheduler_app/views.py	2012-02-09 18:29:39 +0000
+++ lava_scheduler_app/views.py	2012-02-09 20:44:59 +0000
@@ -7,6 +7,7 @@ 
 
 from django.http import (
     HttpResponse,
+    HttpResponseBadRequest,
     HttpResponseForbidden,
     HttpResponseNotAllowed,
     )
@@ -183,7 +184,11 @@ 
 
 
 def job_output(request, pk):
-    start = int(request.GET.get('start', 0))
+    start = request.GET.get('start', 0)
+    try:
+        start = int(start)
+    except ValueError:
+        return HttpResponseBadRequest("invalid start")
     count_present = 'count' in request.GET
     job = get_object_or_404(TestJob, pk=pk)
     log_file = job.log_file