Skip to content

Commit bfd4bb4

Browse files
committed
ensured parent paths are considered relative
technically this is a breaking change, but it doesn't seem likely that anyone is currently relying on the previous restriction to descendants of the reference directory
1 parent 2dfc61f commit bfd4bb4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/util/resolve.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if(!legacy) { // account for bug in Node v8.9.4 and below
1414
}
1515

1616
module.exports = function resolvePath(filepath, referenceDir, { enforceRelative } = {}) {
17-
if(filepath.substr(0, 2) === "./") {
17+
if(/^\.?\.\//.test(filepath)) { // starts with `./` or `../`
1818
return path.resolve(referenceDir, filepath);
1919
} else if(enforceRelative) {
2020
abort(`ERROR: path must be relative: ${repr(filepath)}`);

0 commit comments

Comments
 (0)