浏览代码

Empty URL crashes the server

Gaël Métais 10 年之前
父节点
当前提交
db6fdbc121
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/server/controllers/apiController.js

+ 1 - 1
lib/server/controllers/apiController.js

@@ -21,7 +21,7 @@ var ApiController = function(app) {
     app.post('/api/runs', function(req, res) {
     app.post('/api/runs', function(req, res) {
 
 
         // Add http to the test URL
         // 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;
             req.body.url = 'http://' + req.body.url;
         }
         }