Skip to content

Commit

Permalink
fs: consistently return symlink type from readdir
Browse files Browse the repository at this point in the history
Use 'lstat' to determine type of directory entry.
This is more consistent with the type returned from the readdir binding.
Also use 'path.join' over 'path.resolve' because 'name' is not absolute.
  • Loading branch information
ajafff committed Sep 11, 2018
1 parent 8e73594 commit 6197ca2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/fs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function getDirents(path, [names, types], callback) {
const name = names[i];
const idx = i;
toFinish++;
lazyLoadFs().stat(pathModule.resolve(path, name), (err, stats) => {
lazyLoadFs().lstat(pathModule.join(path, name), (err, stats) => {
if (err) {
callback(err);
return;
Expand All @@ -152,7 +152,7 @@ function getDirents(path, [names, types], callback) {
const type = types[i];
if (type === UV_DIRENT_UNKNOWN) {
const name = names[i];
const stats = lazyLoadFs().statSync(pathModule.resolve(path, name));
const stats = lazyLoadFs().lstatSync(pathModule.join(path, name));
names[i] = new DirentFromStats(name, stats);
} else {
names[i] = new Dirent(names[i], types[i]);
Expand Down

0 comments on commit 6197ca2

Please sign in to comment.