From db6fdbc121db61e5b5c5949a831571ef6b25c3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Fri, 6 Feb 2015 12:32:19 +0100 Subject: [PATCH] Empty URL crashes the server --- lib/server/controllers/apiController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server/controllers/apiController.js b/lib/server/controllers/apiController.js index d087f08..a74d359 100644 --- a/lib/server/controllers/apiController.js +++ b/lib/server/controllers/apiController.js @@ -21,7 +21,7 @@ var ApiController = function(app) { app.post('/api/runs', function(req, res) { // Add http to the test URL - if (req.body.url.toLowerCase().indexOf('http://') !== 0 && req.body.url.toLowerCase().indexOf('https://') !== 0) { + if (req.body.url && req.body.url.toLowerCase().indexOf('http://') !== 0 && req.body.url.toLowerCase().indexOf('https://') !== 0) { req.body.url = 'http://' + req.body.url; }