fix double-URL-encoding causing redirect loops

v1.18.x
Ben Lubar 9 years ago
parent 89aa06526d
commit c7cfe45d0b

@ -52,7 +52,7 @@ categoryController.get = function(req, res, callback) {
} }
if (!res.locals.isAPI && (!req.params.slug || results.categoryData.slug !== cid + '/' + req.params.slug) && (results.categoryData.slug && results.categoryData.slug !== cid + '/')) { if (!res.locals.isAPI && (!req.params.slug || results.categoryData.slug !== cid + '/' + req.params.slug) && (results.categoryData.slug && results.categoryData.slug !== cid + '/')) {
return helpers.redirect(res, '/category/' + encodeURI(results.categoryData.slug)); return helpers.redirect(res, '/category/' + results.categoryData.slug);
} }
var settings = results.userSettings; var settings = results.userSettings;

@ -55,7 +55,7 @@ topicsController.get = function(req, res, callback) {
} }
if (!res.locals.isAPI && (!req.params.slug || results.topic.slug !== tid + '/' + req.params.slug) && (results.topic.slug && results.topic.slug !== tid + '/')) { if (!res.locals.isAPI && (!req.params.slug || results.topic.slug !== tid + '/' + req.params.slug) && (results.topic.slug && results.topic.slug !== tid + '/')) {
var url = '/topic/' + encodeURI(results.topic.slug); var url = '/topic/' + results.topic.slug;
if (req.params.post_index){ if (req.params.post_index){
url += '/'+req.params.post_index; url += '/'+req.params.post_index;
} }

Loading…
Cancel
Save