fs: return Buffer from mkdtemp when prefix is a Buffer#64397
fs: return Buffer from mkdtemp when prefix is a Buffer#64397hamidrezaghavami wants to merge 2 commits into
Conversation
|
Thanks!
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #64397 +/- ##
==========================================
- Coverage 90.25% 90.24% -0.01%
==========================================
Files 741 741
Lines 241207 241225 +18
Branches 45430 45442 +12
==========================================
+ Hits 217698 217704 +6
+ Misses 15084 15082 -2
- Partials 8425 8439 +14
🚀 New features to boost your workflow:
|
40f2ae2 to
3e3da50
Compare
|
@bakkot The CI is green! Here is a quick update: Buffer check: Switched to using the internal Let me know if there is anything else I need to adjust! |
| fs.mkdtemp(Buffer.from(tmpdir.resolve('bar.')), {}, common.mustCall(handler)); | ||
|
|
||
| // Warning fires only once | ||
| fs.mkdtemp(Buffer.from(tmpdir.resolve('bar.X')), common.mustCall(handler)); |
There was a problem hiding this comment.
What happened to these tests?
|
I'm not a maintainer but the new tests look good, thanks. Still not sure about, should it be an error if encoding is explicitly specified and not |
Signed-off-by: Hamid Reza Ghavami <hamidr.ghavami@gmail.com>
3e3da50 to
f06208f
Compare
|
My mistake! I accidentally deleted them while fixing the string coercion bug above. Just restored them in the latest push. |
a3b52bb to
f06208f
Compare
|
@nodejs-github-bot All JavaScript changes and tests are perfectly clean locally! |
This PR fixes an issue where passing a
Bufferas theprefixto thefs.mkdtempfamily of functions incorrectly returned a string, which could mangle non-UTF8 paths.The options encoding is now safely forced to
'buffer'when a Buffer prefix is detected for both the asynchronous, synchronous, and disposable versions.Fixes: #58795