diff options
-rwxr-xr-x | webserver.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/webserver.js b/webserver.js index c3f805a..98a9640 100755 --- a/webserver.js +++ b/webserver.js @@ -252,7 +252,7 @@ function requestFile(req, res, path, origpath, options) { } function makeUrlSafe(req, sliceLength) { - const parsed = url.parse(req.url); + const parsed = new URL(req.url, "https://domain"); const part = parsed.pathname.slice(sliceLength); if (part == "") return "/"; return part.replace(/\/\.+[^\/]*\//g, "/"); @@ -312,8 +312,8 @@ app.get("/.well-known/*rest", function (req, res) { res.sendFile(cmn.webfilesdir + "/" + target + ".html"); }); app.get("/" + target + "/*rest", function (req, res) { - res.set('Content-Type', 'text/html'); - const msg = url.parse(req.url).pathname.slice(target.length + 2); + res.set("Content-Type", "text/html"); + const msg = new URL(req.url, "https://domain").pathname.slice(target.length + 2); res.send( String(fs.readFileSync(cmn.webfilesdir + "/" + target + ".html")) .replace("<!--MESSAGEMESSAGE-->", cmn.simpleHTMLescape(msg)) |