From 91ed1f57c5fb8fdb74e54a0ff065f3a5a06f045f Mon Sep 17 00:00:00 2001 From: Mark Holmquist Date: Mon, 2 Jul 2012 16:46:31 -0700 Subject: [PATCH] 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. --- src/node/hooks/express/padurlsanitize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/hooks/express/padurlsanitize.js b/src/node/hooks/express/padurlsanitize.js index 229d013d..24ec2c3d 100644 --- a/src/node/hooks/express/padurlsanitize.js +++ b/src/node/hooks/express/padurlsanitize.js @@ -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);