fix check if url sent with story

pull/2172/head
Berkeley Martinez 2015-08-18 15:54:58 -07:00
parent 478ed3c522
commit f59d029336
1 changed files with 5 additions and 1 deletions

View File

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