Skip to content

Commit bb6530b

Browse files
ajaffftargos
authored andcommitted
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. PR-URL: #22808 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Bryan English <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 074b7af commit bb6530b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/internal/fs/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function getDirents(path, [names, types], callback) {
131131
const name = names[i];
132132
const idx = i;
133133
toFinish++;
134-
lazyLoadFs().stat(pathModule.resolve(path, name), (err, stats) => {
134+
lazyLoadFs().lstat(pathModule.join(path, name), (err, stats) => {
135135
if (err) {
136136
callback(err);
137137
return;
@@ -154,7 +154,7 @@ function getDirents(path, [names, types], callback) {
154154
const type = types[i];
155155
if (type === UV_DIRENT_UNKNOWN) {
156156
const name = names[i];
157-
const stats = lazyLoadFs().statSync(pathModule.resolve(path, name));
157+
const stats = lazyLoadFs().lstatSync(pathModule.join(path, name));
158158
names[i] = new DirentFromStats(name, stats);
159159
} else {
160160
names[i] = new Dirent(names[i], types[i]);

0 commit comments

Comments
 (0)