Node.js based forum software built for the modern web
fix: dont overwrite postIndex
Barış Soner Uşaklıc21d7dbc7ee8
diff --git a/src/controllers/topics.js b/src/controllers/topics.jsindex 3fa41c4ee8..d177da7cbc 100644--- a/src/controllers/topics.js+++ b/src/controllers/topics.js@@ -76,7 +76,11 @@ topicsController.get = async function getTopic(req, res, next) {if (!req.query.page) {currentPage = calculatePageFromIndex(postIndex, settings);} else {- postIndex = ((currentPage - 1) * settings.postsPerPage) + 1;+ const top = ((currentPage - 1) * settings.postsPerPage) + 1;+ const bottom = top + settings.postsPerPage;+ if (!req.params.post_index || (postIndex < top || postIndex > bottom)) {+ postIndex = top;+ }}}const { start, stop } = calculateStartStop(currentPage, postIndex, settings);