Skip to content

Commit 993f05d

Browse files
Flarnatargos
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 <luigipinca@gmail.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
1 parent ac78491 commit 993f05d

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

19961996
#ifdef _WIN32
1997-
if (slashCheck) {
1997+
if (slashCheck && !path.ToStringView().ends_with("\\")) {
19981998
size_t new_length = path.length() + 1;
19991999
path.AllocateSufficientStorage(new_length + 1);
20002000
path.SetLengthAndZeroTerminate(new_length);

0 commit comments

Comments
 (0)