Skip to content

Commit

Permalink
url: replace deprecated substr() -> substring()
Browse files Browse the repository at this point in the history
  • Loading branch information
pluris committed Jan 23, 2024
1 parent 880c90c commit 879629c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(srcPathSlashes.length - 1) !== '/')) {
srcPath.push('');
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 879629c

Please sign in to comment.