Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
'use strict';

const {
ArrayPrototypeJoin,
Boolean,
Int8Array,
ObjectAssign,
ObjectKeys,
StringPrototypeAt,
StringPrototypeCharCodeAt,
StringPrototypeIndexOf,
StringPrototypeReplaceAll,
Expand Down Expand Up @@ -919,7 +921,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
// If a url ENDs in . or .., then it must get a trailing slash.
// however, if it ends in anything else non-slashy,
// then it must NOT get a trailing slash.
let last = srcPath.slice(-1)[0];
let last = srcPath[srcPath.length - 1];
const hasTrailingSlash = (
((result.host || relative.host || srcPath.length > 1) &&
(last === '.' || last === '..')) || last === '');
Expand Down Expand Up @@ -952,7 +954,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
srcPath.unshift('');
}

if (hasTrailingSlash && (srcPath.join('/').slice(-1) !== '/')) {
if (hasTrailingSlash && StringPrototypeAt(ArrayPrototypeJoin(srcPath, '/'), -1) !== '/') {
srcPath.push('');
}

Expand Down
Loading