From 1ae35a197759b0a38c203ffc62c98237ca168cd9 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 21 Apr 2024 16:46:01 +0200 Subject: [PATCH] Replace (...).indexOf("/") != 0 with (...)[0] != "/" --- svr.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svr.js b/svr.js index bbbc66d..7ab9945 100644 --- a/svr.js +++ b/svr.js @@ -2984,7 +2984,7 @@ if (!cluster.isPrimary) { } }); var isProxy = false; - if (req.url.indexOf("/") != 0 && req.url != "*") isProxy = true; + if (req.url[0] != "/" && req.url != "*") isProxy = true; serverconsole.locmessage("Somebody connected to " + (secure && fromMain ? ((typeof sport == "number" ? "port " : "socket ") + sport) : ((typeof port == "number" ? "port " : "socket ") + port)) + "..."); if (req.socket == null) { @@ -3314,7 +3314,7 @@ if (!cluster.isPrimary) { if (uobject.href != "") nuobject.href = uobject.href; // Adjust the pathname and href properties if the URI doesn't start with "/" - if (preparedURI.indexOf("/") != 0) { + if (preparedURI[0] != "/") { if (nuobject.pathname) { nuobject.pathname = nuobject.pathname.substring(1); nuobject.href = nuobject.pathname + (nuobject.search ? nuobject.search : "");