Skip to content

fs: fix buffer input with recursive mode on readdir #59220

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

himself65
Copy link
Member

Fixes: #58892

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner
  • @nodejs/url

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jul 26, 2025
@himself65 himself65 marked this pull request as ready for review July 26, 2025 09:47
Copy link

codecov bot commented Jul 26, 2025

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.94%. Comparing base (6ea421a) to head (841ee6c).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/node_file.cc 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59220      +/-   ##
==========================================
- Coverage   90.06%   89.94%   -0.13%     
==========================================
  Files         648      646       -2     
  Lines      191065   190666     -399     
  Branches    37456    37309     -147     
==========================================
- Hits       172092   171500     -592     
- Misses      11601    11876     +275     
+ Partials     7372     7290      -82     
Files with missing lines Coverage Δ
lib/fs.js 98.18% <100.00%> (+<0.01%) ⬆️
lib/internal/fs/utils.js 99.38% <100.00%> (+0.01%) ⬆️
src/node_file.cc 75.54% <0.00%> (-0.32%) ⬇️

... and 69 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@himself65
Copy link
Member Author

this might be not a good solution. let me find another way

@aduh95
Copy link
Contributor

aduh95 commented Jul 26, 2025

That's definitely a wrong solution, we need Buffer to support non-unicode paths

@himself65
Copy link
Member Author

yeah, I see path = getValidatedPath(path); is a misleading code, the rest of the logic is pretending path is string but it's actually not. If I change getValidatedPath to support buffer + options.encoding I would guess it will have lot of performance regression

@himself65
Copy link
Member Author

I think I find a good way

@himself65 himself65 changed the title fs: convert to string if input path is buffer fs: fix buffer input with recursive mode on readdir Jul 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

all versions of readdir don't work in recursive mode when used with a buffer argument
3 participants