Skip to content

Commit f6ea5bf

Browse files
authored
fs,win: do not add a second trailing slash in readdir
Do not add a trailing slash if it was not removed by resolve in ToNamespacedPath. PR-URL: #59847 Fixes: #58223 Refs: #56110 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Stefan Stojanovic <[email protected]>
1 parent e596098 commit f6ea5bf

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)