mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
padurlsanitize.js: invert a condition prior to refactoring
Extracted from Ray's work.
This commit is contained in:
parent
d5d28717c4
commit
b699621e5a
1 changed files with 4 additions and 4 deletions
|
@ -12,7 +12,10 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
padManager.sanitizePadId(padId, function(sanitizedPadId) {
|
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
|
// the pad id was sanitized, so we redirect to the sanitized version
|
||||||
var real_url = sanitizedPadId;
|
var real_url = sanitizedPadId;
|
||||||
real_url = encodeURIComponent(real_url);
|
real_url = encodeURIComponent(real_url);
|
||||||
|
@ -20,9 +23,6 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
if ( query ) real_url += '?' + query;
|
if ( query ) real_url += '?' + query;
|
||||||
res.header('Location', real_url);
|
res.header('Location', real_url);
|
||||||
res.status(302).send('You should be redirected to <a href="' + real_url + '">' + real_url + '</a>');
|
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();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue