mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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:
1 parent
378a772034
commit
30cec18eeb
2 files changed
+6
-1
No files matched your search
@@ -1281,6 +1281,10 @@ const posix = {
|
||||
// We get here if `from` is the exact base path for `to`.
|
||||
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -481,7 +481,8 @@ const relativeTests = [
|
||||
['/var/lib', '/var/apache', '../apache'],
|
||||
['/var/', '/var/lib', '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', '../..']
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user