From d6f669ef3f0b81271bfebdb0b96c0c820e794685 Mon Sep 17 00:00:00 2001 From: accalia Date: Thu, 10 Mar 2016 22:49:57 -0500 Subject: [PATCH] fix #4350; When redirecting to fix slug, preserve any provided post_index --- src/controllers/topics.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 7f9842ba03..7a222dd09c 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -55,7 +55,11 @@ topicsController.get = function(req, res, callback) { } if ((!req.params.slug || results.topic.slug !== tid + '/' + req.params.slug) && (results.topic.slug && results.topic.slug !== tid + '/')) { - return helpers.redirect(res, '/topic/' + encodeURI(results.topic.slug)); + var url = '/topic/' + encodeURI(results.topic.slug); + if (req.params.post_index){ + url += '/'+req.params.post_index; + } + return helpers.redirect(res, url); } var settings = results.settings;