summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-07-23 11:43:17 +0200
committerTom Smeding <tom@tomsmeding.com>2025-07-23 11:43:17 +0200
commit8b3c8795cffe922bfc5ab5962dce19b4804abd68 (patch)
tree3f46abef79d4b071e5be5c52daadf6cd5a0186c8
parent4604d76cd4eb95aa2d7997a1f2f8121e391e93ab (diff)
Use URL instead of url.parseHEADmaster
Don't think it matters in this case, but whatever
-rwxr-xr-xwebserver.js6
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))