diff --git a/src/node/hooks/express/padurlsanitize.js b/src/node/hooks/express/padurlsanitize.js index a7fb9f33e..b5ce926ae 100644 --- a/src/node/hooks/express/padurlsanitize.js +++ b/src/node/hooks/express/padurlsanitize.js @@ -12,7 +12,10 @@ exports.expressCreateServer = function (hook_name, args, cb) { } padManager.sanitizePadId(padId, function(sanitizedPadId) { - if (sanitizedPadId != padId) { + if (sanitizedPadId === padId) { + // the pad id was fine, so just render it + next(); + } else { // the pad id was sanitized, so we redirect to the sanitized version var real_url = sanitizedPadId; real_url = encodeURIComponent(real_url); @@ -20,9 +23,6 @@ exports.expressCreateServer = function (hook_name, args, cb) { if ( query ) real_url += '?' + query; res.header('Location', real_url); res.status(302).send('You should be redirected to ' + real_url + ''); - } else { - // the pad id was fine, so just render it - next(); } }); });