-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Description
Version
All
Platform
All
Subsystem
fs
What steps will reproduce the bug?
Calling readdir
with a Buffer argument and the recursive
flag produces an ERR_INVALID_ARG_TYPE
error
Because of this join
:
Line 1434 in 139c2e1
const resultPath = pathModule.join(currentPath, result[i]); |
After that there are also some other join
s that would kick in as well:
node/lib/internal/fs/promises.js
Line 897 in 139c2e1
const direntPath = pathModule.join(path, dirent.name); node/lib/internal/fs/promises.js
Line 918 in 139c2e1
const direntPath = pathModule.join(path, ent);
This happens with all version of readdir
both the callback and promises versions (since they share the same code (referred by the above links)) as well as readdirSync
(since that also uses the same processReaddirResult` utility the other two do)
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
The expected behavior would be for the readdir
functions not to error and return either an array of Buffer
s or Dirent
s (depending on options.withFileTypes
)
This is the behavior described in the documentation:
What do you see instead?
Unexpected ERR_INVALID_ARG_TYPE
errors are getting thrown
Additional information
This issue is the equivalent to #58634 but for readdir