From 7242e8c8938879b4a07f32fa106bbf5bc3146df3 Mon Sep 17 00:00:00 2001 From: pluris Date: Tue, 23 Jan 2024 08:28:56 +0900 Subject: [PATCH] url: replace deprecated `substr()` -> `substring()` --- lib/url.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/url.js b/lib/url.js index b6b5376c379a6c..4ec0ad3ee11d79 100644 --- a/lib/url.js +++ b/lib/url.js @@ -958,7 +958,8 @@ Url.prototype.resolveObject = function resolveObject(relative) { srcPath.unshift(''); } - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + const srcPathSlashes = srcPath.join('/'); + if (hasTrailingSlash && (srcPathSlashes.substring(srcPathJoin.length - 1) !== '/')) { srcPath.push(''); } @@ -990,7 +991,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { result.pathname = null; result.path = null; } else { - result.pathname = srcPath.join('/'); + result.pathname = srcPathSlashes; } // To support request.http