diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2016-11-04 01:51:09 +0300 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2016-11-04 05:18:07 +0300 |
commit | a52d0f0c9cf2de5caef77e12eabd7dca9e89b49c (patch) | |
tree | c17fdb8ca926a8332daedf442d3cbf08b7d3e139 /node_modules/glob/glob.js | |
parent | 7f41295775f28b958a926f9cb371cb37b05771dd (diff) |
glob@7.1.1
- Handle files without associated perms on Windows.
- Fix failing case with `absolute` option.
Credit: @isaacs
Credit: @phated
Fixes: isaacs/node-glob#245
Fixes: isaacs/node-glob#249
Reviewed-By: @othiym23
Diffstat (limited to 'node_modules/glob/glob.js')
-rw-r--r-- | node_modules/glob/glob.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/node_modules/glob/glob.js b/node_modules/glob/glob.js index 4078f468c..bfdd7a11b 100644 --- a/node_modules/glob/glob.js +++ b/node_modules/glob/glob.js @@ -465,7 +465,7 @@ Glob.prototype._emitMatch = function (index, e) { return } - var abs = this._makeAbs(e) + var abs = isAbsolute(e) ? e : this._makeAbs(e) if (this.mark) e = this._mark(e) @@ -508,15 +508,15 @@ Glob.prototype._readdirInGlobStar = function (abs, cb) { fs.lstat(abs, lstatcb) function lstatcb_ (er, lstat) { - if (er) + if (er && er.code === 'ENOENT') return cb() - var isSym = lstat.isSymbolicLink() + var isSym = lstat && lstat.isSymbolicLink() self.symlinks[abs] = isSym // If it's not a symlink or a dir, then it's definitely a regular file. // don't bother doing a readdir in that case. - if (!isSym && !lstat.isDirectory()) { + if (!isSym && lstat && !lstat.isDirectory()) { self.cache[abs] = 'FILE' cb() } else @@ -769,7 +769,7 @@ Glob.prototype._stat = function (f, cb) { } Glob.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { this.statCache[abs] = false return cb() } @@ -777,13 +777,15 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) { var needDir = f.slice(-1) === '/' this.statCache[abs] = stat - if (abs.slice(-1) === '/' && !stat.isDirectory()) + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) return cb(null, false, stat) - var c = stat.isDirectory() ? 'DIR' : 'FILE' + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' this.cache[abs] = this.cache[abs] || c - if (needDir && c !== 'DIR') + if (needDir && c === 'FILE') return cb() return cb(null, c, stat) |