diff --git a/lib/url.js b/lib/url.js index b3083abfde9f41..9cfcb54dd3f8ad 100644 --- a/lib/url.js +++ b/lib/url.js @@ -847,7 +847,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 (var i = srcPath.length; i >= 0; i--) { + for (var i = srcPath.length - 1; i >= 0; i--) { last = srcPath[i]; if (last === '.') { spliceOne(srcPath, i);