diff --git a/lib/url.js b/lib/url.js index f2a627fbbeaf9e..e75b829ddff0f2 100644 --- a/lib/url.js +++ b/lib/url.js @@ -634,7 +634,7 @@ Url.prototype.resolveObject = function(relative) { // strip single dots, resolve double dots to parent dir // if the path tries to go above the root, `up` ends up > 0 var up = 0; - for (let i = srcPath.length; i >= 0; i--) { + for (var i = srcPath.length - 1; i >= 0; i--) { last = srcPath[i]; if (last === '.') { spliceOne(srcPath, i);