Skip to content

Commit 85818db

Browse files
Flarnaaduh95
authored andcommitted
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 36b68db commit 85818db

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
@@ -1902,7 +1902,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
19021902
ToNamespacedPath(env, &path);
19031903

19041904
#ifdef _WIN32
1905-
if (slashCheck) {
1905+
if (slashCheck && !path.ToStringView().ends_with("\\")) {
19061906
size_t new_length = path.length() + 1;
19071907
path.AllocateSufficientStorage(new_length + 1);
19081908
path.SetLengthAndZeroTerminate(new_length);

0 commit comments

Comments
 (0)