mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Close GH-795: Ignore file symlinks when reading project, fixes #791 and #783.. Fixes #791, Fixes #783
This commit is contained in:
@@ -638,6 +638,11 @@ Project.prototype._readLinks = function () {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip links to files (see #783)
|
||||
if (!valid.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = path.basename(dir);
|
||||
return readJson(dir, {
|
||||
assume: { name: name }
|
||||
|
||||
@@ -2,16 +2,17 @@ var Q = require('q');
|
||||
var fs = require('graceful-fs');
|
||||
|
||||
function validLink(file) {
|
||||
// Filter only those that are valid links
|
||||
// Ensures that a file is a symlink that points
|
||||
// to a valid file
|
||||
return Q.nfcall(fs.lstat, file)
|
||||
.then(function (stat) {
|
||||
if (!stat.isSymbolicLink()) {
|
||||
return [false, null];
|
||||
return [false];
|
||||
}
|
||||
|
||||
return Q.nfcall(fs.stat, file)
|
||||
.then(function () {
|
||||
return [true, null];
|
||||
return [stat];
|
||||
});
|
||||
})
|
||||
.fail(function (err) {
|
||||
|
||||
Reference in New Issue
Block a user