mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
padurlsanitize: early return, no functional changes
This commit is contained in:
parent
d19436d044
commit
391bd79e03
1 changed files with 19 additions and 20 deletions
|
@ -8,26 +8,25 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
if(!padManager.isValidPadId(padId) || /\/$/.test(req.url))
|
if(!padManager.isValidPadId(padId) || /\/$/.test(req.url))
|
||||||
{
|
{
|
||||||
res.status(404).send('Such a padname is forbidden');
|
res.status(404).send('Such a padname is forbidden');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
padManager.sanitizePadId(padId, function(sanitizedPadId) {
|
||||||
padManager.sanitizePadId(padId, function(sanitizedPadId) {
|
//the pad id was sanitized, so we redirect to the sanitized version
|
||||||
//the pad id was sanitized, so we redirect to the sanitized version
|
if(sanitizedPadId != padId)
|
||||||
if(sanitizedPadId != padId)
|
{
|
||||||
{
|
var real_url = sanitizedPadId;
|
||||||
var real_url = sanitizedPadId;
|
real_url = encodeURIComponent(real_url);
|
||||||
real_url = encodeURIComponent(real_url);
|
var query = url.parse(req.url).query;
|
||||||
var query = url.parse(req.url).query;
|
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>');
|
}
|
||||||
}
|
//the pad id was fine, so just render it
|
||||||
//the pad id was fine, so just render it
|
else
|
||||||
else
|
{
|
||||||
{
|
next();
|
||||||
next();
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue