Merge branch 'staging' of github.com:FreeCodeCamp/freecodecamp into staging

pull/797/head
Quincy Larson 2015-05-31 15:43:33 -07:00
commit d0ce7f930a
1 changed files with 4 additions and 2 deletions

View File

@ -330,8 +330,8 @@ exports.storySubmission = function(req, res, next) {
return next(new Error('Not authorized'));
}
var storyLink = data.headline
.replace(/\s+/g, ' ')
.replace(/[^a-z0-9\s]/gi, '')
.replace(/\s+/g, ' ')
.toLowerCase()
.trim();
var link = data.link;
@ -346,6 +346,8 @@ exports.storySubmission = function(req, res, next) {
// if duplicate storyLink add unique number
storyLink = (storyCount === 0) ? storyLink : storyLink + ' ' + storyCount;
debug(storyLink);
var link = data.link;
if (link.search(/^https?:\/\//g) === -1) {
link = 'http://' + link;
@ -389,7 +391,7 @@ exports.storySubmission = function(req, res, next) {
}
});
res.send(JSON.stringify({
storyLink: story.storyLink.replace(/\s/g, '-').toLowerCase()
storyLink: story.storyLink.replace(/\s+/g, '-').toLowerCase()
}));
});
});