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 1 commit into
Conversation
|
Thanks!
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #64397 +/- ##
==========================================
- Coverage 90.24% 90.24% -0.01%
==========================================
Files 741 741
Lines 241384 241393 +9
Branches 45480 45485 +5
==========================================
- Hits 217844 217838 -6
+ Misses 15097 15094 -3
- Partials 8443 8461 +18
🚀 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 |
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/collaborators All JavaScript changes and tests are perfectly clean locally! |
|
Please do not add merge commits, it breaks the tooling. https://github.com/nodejs/node/blob/main/doc/contributing/pull-requests.md#step-5-rebase |
546cb14 to
e4ebc2b
Compare
Signed-off-by: Hamid Reza Ghavami <hamidr.ghavami@gmail.com>
e4ebc2b to
40fba96
Compare
|
Thank you so much @aduh95 for stepping in and pushing that final fix—you are a lifesaver! 🙏 All 31 checks are completely green now! 🚀 |
|
Looks like a response is outstanding to #64397 (comment) |
|
@Renegade334 Thanks for pointing that out! Since bakkot mentioned he isn't a core maintainer, I wasn't sure if his question was a required change or just a general discussion, especially since @aduh95 already reviewed and force-pushed the final code today. Could you clarify if there is still anything specific you would like me to change, or are we good to go? 🙏 |
|
@hamidrezaghavami The link goes to my comment about deleted tests, not my question about an error. You said you'd restored the deleted tests but I think that got lost in your rebase. Those tests are still missing and you should presumably put them back. |
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