From fd676c163d4d9499bc90612bbfa09af2e3c3b136 Mon Sep 17 00:00:00 2001 From: paulr Date: Sun, 30 Dec 2012 21:50:40 +1100 Subject: [PATCH] fixing a purl so it uses the start of the url for the pathname --- lib/wsrequest.js | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/wsrequest.js b/lib/wsrequest.js index 6f7cb52..81278bc 100644 --- a/lib/wsrequest.js +++ b/lib/wsrequest.js @@ -137,8 +137,11 @@ function urlServicer(request, response, purl) { } } } else { - // handle the purls - var newPurlPath = mainPath+"/"+path.basename(purl.pathname.replace(/\/$/, ""))+".js"; + // handle the purls... we taje the pathname, drop the beginning "/", then drop every after the next "/" + // so we end up with a purl of "abcd" from a url: + // http://host/abcd/qewr/asdf/asdf/asdf/asdf/asdf/ + // and will load mainPath/abcd.js + var newPurlPath = mainPath+"/"+path.basename(purl.pathname.replace(/^\//, "").replace(/\/.*$/, ""))+".js"; console.log("attempting to require: ", newPurlPath); try { var newPurlClass = require(newPurlPath); -- 1.7.0.4