mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 15:05:46 +01:00
small fix to redirect
This commit is contained in:
@@ -86,9 +86,9 @@ middleware.checkPostIndex = function(req, res, next) {
|
|||||||
}
|
}
|
||||||
var postIndex = parseInt(req.params.post_index, 10);
|
var postIndex = parseInt(req.params.post_index, 10);
|
||||||
if (postIndex > postCount) {
|
if (postIndex > postCount) {
|
||||||
return res.redirect('/topic/' + req.params.topic_id + '/' + req.params.slug + '/' + postCount);
|
return res.locals.isAPI ? res.json(302, '/topic/' + req.params.topic_id + '/' + req.params.slug + '/' + postCount) : res.redirect('/topic/' + req.params.topic_id + '/' + req.params.slug + '/' + postCount);
|
||||||
} else if (postIndex <= 1) {
|
} else if (postIndex < 1) {
|
||||||
return res.redirect('/topic/' + req.params.topic_id + '/' + req.params.slug);
|
return res.locals.isAPI ? res.json(302, '/topic/' + req.params.topic_id + '/' + req.params.slug) : res.redirect('/topic/' + req.params.topic_id + '/' + req.params.slug);
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user