Skip to content

Commit 6197ca2

Browse files
committed
fs: consistently return symlink type from readdir
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.
1 parent 8e73594 commit 6197ca2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/internal/fs/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function getDirents(path, [names, types], callback) {
129129
const name = names[i];
130130
const idx = i;
131131
toFinish++;
132-
lazyLoadFs().stat(pathModule.resolve(path, name), (err, stats) => {
132+
lazyLoadFs().lstat(pathModule.join(path, name), (err, stats) => {
133133
if (err) {
134134
callback(err);
135135
return;
@@ -152,7 +152,7 @@ function getDirents(path, [names, types], callback) {
152152
const type = types[i];
153153
if (type === UV_DIRENT_UNKNOWN) {
154154
const name = names[i];
155-
const stats = lazyLoadFs().statSync(pathModule.resolve(path, name));
155+
const stats = lazyLoadFs().lstatSync(pathModule.join(path, name));
156156
names[i] = new DirentFromStats(name, stats);
157157
} else {
158158
names[i] = new Dirent(names[i], types[i]);

0 commit comments

Comments
 (0)