-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
fs: fix ENOTDIR in globSync when file is treated as dir #61259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
`fs.globSync` failed with `ENOTDIR` when a path component in a glob
pattern was a file but used as a directory (e.g., 'foo{,/bar}' when
'foo' is a file).
This change aligns `getDirentSync` with the asynchronous `getDirent`
by wrapping the `lstatSync` call in a `try-catch` block to safely
return `null` on such errors.
Fixes: nodejs#61257
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61259 +/- ##
==========================================
+ Coverage 88.00% 88.52% +0.52%
==========================================
Files 704 704
Lines 208739 208741 +2
Branches 40196 40277 +81
==========================================
+ Hits 183706 184794 +1088
+ Misses 16992 15958 -1034
+ Partials 8041 7989 -52
🚀 New features to boost your workflow:
|
Co-authored-by: René <[email protected]>
285ded7 to
d2e58e3
Compare
|
Thanks for the approval @Renegade334 |
|
Not until the security releases, no. |
Understood. I'll wait until the security releases are out. Thanks for letting me know. |
fs.globSyncfailed withENOTDIRwhen a path component in a glob pattern was a file but used as a directory (e.g., 'foo{,/bar}' when 'foo' is a file).This change aligns
getDirentSyncwith the asynchronousgetDirentby wrapping thelstatSynccall in atry-catchblock to safely returnnullon such errors.Fixes: #61257