mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 23:15:48 +01:00
fixes redirect loop for empty slugs
This commit is contained in:
@@ -59,7 +59,7 @@ middleware.redirectToAccountIfLoggedIn = function(req, res, next) {
|
|||||||
middleware.addSlug = function(req, res, next) {
|
middleware.addSlug = function(req, res, next) {
|
||||||
function redirect(method, id, name) {
|
function redirect(method, id, name) {
|
||||||
method(id, 'slug', function(err, slug) {
|
method(id, 'slug', function(err, slug) {
|
||||||
if (err || !slug) {
|
if (err || !slug || slug === id + '/') {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
res.redirect(name + slug);
|
res.redirect(name + slug);
|
||||||
|
|||||||
Reference in New Issue
Block a user