From 7b0ee7b4136ddcf49e10b4445693ba37ddbd1762 Mon Sep 17 00:00:00 2001 From: Shahar Talmi Date: Sun, 28 Feb 2016 22:27:54 +0200 Subject: [PATCH] fix(doesPathContain): make code more readable and workaround node 5.7.0 issue Closes #1469 --- .travis.yml | 1 + lib/grunt/file.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c7b8f8c16..a4a971257 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ node_js: - "4.1" - "4.2" - "5" + - "5.7" - "iojs" before_install: - npm install -g npm diff --git a/lib/grunt/file.js b/lib/grunt/file.js index 46c415d06..b4a1f5251 100644 --- a/lib/grunt/file.js +++ b/lib/grunt/file.js @@ -440,8 +440,8 @@ file.doesPathContain = function(ancestor) { ancestor = path.resolve(ancestor); var relative; for (var i = 1; i < arguments.length; i++) { - relative = path.relative(path.resolve(arguments[i]), ancestor); - if (relative === '' || /\w+/.test(relative)) { return false; } + relative = path.relative(ancestor, path.resolve(arguments[i])); + if (relative === '' || /^\.\./.test(relative)) { return false; } } return true; };