path: fix verbose relative() output
Fixes: https://github.com/nodejs/node/issues/5383 PR-URL: https://github.com/nodejs/node/pull/5389 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Evan Lucas <evanlucas@me.com>
This commit is contained in:
parent
5298c81f42
commit
3a331b66f8
@ -1282,6 +1282,10 @@ const posix = {
|
|||||||
// We get here if `from` is the exact base path for `to`.
|
// We get here if `from` is the exact base path for `to`.
|
||||||
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
||||||
return to.slice(i + 2);
|
return to.slice(i + 2);
|
||||||
|
} else if (fromLen > length && from.charCodeAt(i + 1) === 47/*/*/) {
|
||||||
|
// We get here if `to` is the exact base path for `from`.
|
||||||
|
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
||||||
|
lastCommonSep = i;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,8 @@ const relativeTests = [
|
|||||||
['/var/lib', '/var/apache', '../apache'],
|
['/var/lib', '/var/apache', '../apache'],
|
||||||
['/var/', '/var/lib', 'lib'],
|
['/var/', '/var/lib', 'lib'],
|
||||||
['/', '/var/lib', 'var/lib'],
|
['/', '/var/lib', 'var/lib'],
|
||||||
['/foo/test', '/foo/test/bar/package.json', 'bar/package.json']
|
['/foo/test', '/foo/test/bar/package.json', 'bar/package.json'],
|
||||||
|
['/Users/a/web/b/test/mails', '/Users/a/web/b', '../..']
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user