From 852d70f49a03fbfca43e9044f43b586abc37e624 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 26 Dec 2016 10:20:53 +0100 Subject: fix HEAD^ --- webserver.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/webserver.js b/webserver.js index 62a1719..84864cd 100755 --- a/webserver.js +++ b/webserver.js @@ -52,8 +52,7 @@ for(i=0;i",basefname) + .replace("",path) .replace("[/*LISTINGLISTING*/]",JSON.stringify(items)) ); } else res.send("I don't recognise that file."); } -function makeUrlSafe(req){ - var parsed=url.parse(req.url),basefname=parsed.pathname.slice(2).replace(/\/\.+[^\/]*\//g,"/"); - return basefname; +function makeUrlSafe(req,sliceLength){ + var parsed=url.parse(req.url); + return parsed.pathname.slice(sliceLength).replace(/\/\.+[^\/]*\//g,"/"); } @@ -94,11 +93,11 @@ app.get("/",function(req,res){ app.get(["/f/univq","/f/univq/*"],cmn.authgen()); app.get("/f/*",function(req,res){ - requestFile(req,res,makeUrlSafe(req)); + requestFile(req,res,makeUrlSafe(req,2)); }); app.get("/.well-known/*",function(req,res){ - requestFile(req,res,"/well-known"+makeUrlSafe(req)); + requestFile(req,res,"/well-known"+makeUrlSafe(req,12)); }); ["o","k","rip","rip2"].forEach(function(target){ -- cgit v1.2.3-70-g09d2