diff --git a/controllers/courseware.js b/controllers/courseware.js index cac15ab86f..716e7d00d2 100644 --- a/controllers/courseware.js +++ b/controllers/courseware.js @@ -57,8 +57,6 @@ exports.returnIndividualCourseware = function(req, res, next) { if (err) { next(err); } - courseware = courseware.pop(); - // Handle not found if (courseware.length < 1) { req.flash('errors', { @@ -66,6 +64,7 @@ exports.returnIndividualCourseware = function(req, res, next) { }); return res.redirect('/coursewares') } + courseware = courseware.pop(); // Redirect to full name if the user only entered a partial var dashedNameFull = courseware.name.toLowerCase().replace(/\s/g, '-');