Don't rewrite in a stupid way

Since we're already in the proper path for the pad, why worry
about it? Replacing the entire path of the URL with /p/padname may
have seemed like a good idea at the time, but really, for a 302 we
only need a relative pathname. This patch provides the proper way.
pull/833/head
Mark Holmquist 2012-07-02 16:46:31 -07:00
parent afa107e809
commit 91ed1f57c5
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ exports.expressCreateServer = function (hook_name, args, cb) {
//the pad id was sanitized, so we redirect to the sanitized version
if(sanitizedPadId != padId)
{
var real_url = req.url.replace(/^\/p\/[^\/]+/, '/p/' + sanitizedPadId);
var real_url = sanitizedPadId;
var query = url.parse(req.url).query;
if ( query ) real_url += '?' + query;
res.header('Location', real_url);