From 79ab296f1ff18085e0b9e95af4567cc4801263ef Mon Sep 17 00:00:00 2001 From: jomo Date: Sat, 25 Apr 2015 15:49:47 +0200 Subject: [PATCH] get rid of path.resolve This doesn't handle '..' and other things that path.resolve does, but if you're passing weird things to a URL, your fault. --- lib/server.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/server.js b/lib/server.js index 2f90489..a990a18 100644 --- a/lib/server.js +++ b/lib/server.js @@ -44,9 +44,8 @@ function request_id() { // splits a URL path into an Array // the path is resolved and decoded function path_list(pathname) { - // remove trailing and double slashes + other junk - - pathname = path.resolve(pathname); + // remove double and trailing slashes + pathname = pathname.replace(/\/\/+/g, "/").replace(/\/$/, ""); var list = pathname.split("/"); list.shift(); for (var i = 0; i < list.length; i++) {