From f59d029336952ea9ea812c7ac12bbf428f8f7489 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 18 Aug 2015 15:54:58 -0700 Subject: [PATCH] fix check if url sent with story --- server/boot/story.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/boot/story.js b/server/boot/story.js index 0a2af6d96c..7b3c058ea1 100755 --- a/server/boot/story.js +++ b/server/boot/story.js @@ -107,8 +107,12 @@ module.exports = function(app) { }); } - function preSubmit(req, res) { + function preSubmit(req, res, next) { var data = req.query; + if (typeof data.url !== 'string') { + req.flash('errors', { msg: 'No URL supplied with story' }); + return next(new TypeError('No URL supplied with story')); + } var cleanedData = cleanData(data.url); if (data.url.replace(/&/g, '&') !== cleanedData) {