padurlsanitize.js: invert a condition prior to refactoring

Extracted from Ray's work.
pull/3559/head
muxator 2019-02-09 00:05:21 +01:00
parent d5d28717c4
commit b699621e5a
1 changed files with 4 additions and 4 deletions

View File

@ -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 <a href="' + real_url + '">' + real_url + '</a>');
} else {
// the pad id was fine, so just render it
next();
}
});
});