Skip to content

Commit 9fa3263

Browse files
committed
fs,win: do not add a second trailing slash in readdir
Improve the fix done in nodejs#56110 to add the trailing slash only if it was removed.
1 parent 8756a5a commit 9fa3263

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
19881988
ToNamespacedPath(env, &path);
19891989

19901990
#ifdef _WIN32
1991-
if (slashCheck) {
1991+
if (slashCheck && !path.ToStringView().ends_with("\\")) {
19921992
size_t new_length = path.length() + 1;
19931993
path.AllocateSufficientStorage(new_length + 1);
19941994
path.SetLengthAndZeroTerminate(new_length);

0 commit comments

Comments
 (0)