Uh oh!
There was an error while loading. Please reload this page.
[v18.x backport] fs: fix the file name is not included when the withFileTypes option of readdir - #53969
[v18.x backport] fs: fix the file name is not included when the withFileTypes option of readdir#53969sonsurim wants to merge 3 commits into
Conversation
3ef999e to
7e1b5deComparedaeyeon
commented
Jul 21, 2024
Congrats on your first contribution! 🎉 |
9d97bac to
d740bdbComparesonsurim
commented
Jul 21, 2024
The git config was not set up properly, so I committed it again. 😅 |
aduh95
left a comment
There was a problem hiding this comment.
This one is simply very hard to fix without introducing more breaking changes. It might be more wise to consider dirent.path irremediably broken and switch to using dirent.parentPath which is stable.
There was a problem hiding this comment.
This change is not OK, we cannot make this kind of breaking change, especially on a maintenance LTS line. This needs to remain as it was on v18.19.1:
sonsurim
commented
Jul 21, 2024
@aduh95 Thanks for the review!
Does the above mean modifying the // dir.jsreadSyncRecursive(dirent){constctx={path: dirent.parentPath};consthandle=dirBinding.opendir(pathModule.toNamespacedPath(dirent.parentPath),this[kDirOptions].encoding,undefined,ctx,);handleErrorFromBinding(ctx);constresult=handle.read(this[kDirOptions].encoding,this[kDirOptions].bufferSize,undefined,ctx,);if(result){this.processReadResult(dirent.parentPath,result);}handle.close(undefined,ctx);handleErrorFromBinding(ctx);}Could you please help me a little more? |
aduh95
commented
Jul 21, 2024
No I meant for user land, Im unsure fixing it in Node.js is worth it |
The issue was caused by a modification in PR nodejs#51021, which included changes to the documentation for parentPath and modifications to display the file path. I have retained the content related to the documentation and removed the filepath part. Fixes: nodejs#52441 Co-authored-by: injae-kim <injae-kim@users.noreply.github.com>
An error occurred in the test/sequential/test-fs-opendir-recursive.js file after changing the code. This was resolved by referring to the code resolved in PR nodejs#49603. Refs: nodejs#49603
The getDirentPath function in test/sequential/test-fs-opendir-recursive.js has been reverted for stability. Refs: nodejs#53969 (comment)
b2d61d8 to
4d34bb6CompareH4ad
commented
Jul 21, 2024
Doesn't make sense this statement since on the sync version we have the correct behavior, unless you want to change the sync version. |
aduh95
commented
Jul 21, 2024
No that would be equally unwise IMO. What I'm saying is that |
sonsurim
commented
Jul 24, 2024
I will wait for the direction of the work to be decided. If you decide, please let me know! |
This fixes the issue reported in #52441
The issue was caused by a modification in PR #51021 , which was working on including the
parentPathin the documentation and modifying thepathto display thefilepath.I have retained the content related to the documentation and removed the
filepathpart. Corresponding test code has also been updated accordingly.An error occurred in the
test/sequential/test-fs-opendir-recursive.jsfile after changing the code. This was resolved by referring to the code resolved in #49603 .cc. @H4ad@daeyeon
Screenshots
AS-IS
You can see that even the file name is exposed in the
path.TO-BE
Now the file name has been removed from the
path!References
dirent.parentPath#50976dirent.parentPath#51021