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) {