vfs: fix path returned by recursive mkdir - #65062
Open
watilde wants to merge 1 commit into
Open
Conversation
`mkdir()` with `recursive: true` returns the first directory that was created. VFS passed the provider's return value straight through, so the path came back in the wrong namespace: `RealFSProvider` returned an absolute path inside its root, leaking that root to the caller, and a mounted VFS returned a VFS-internal path without the mount point. Map the created path back through the provider and mount translations so the returned value is a path the caller can hand to `fs` again. This covers the sync, callback, and promises forms.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65062 +/- ##
=======================================
Coverage 90.30% 90.30%
=======================================
Files 759 759
Lines 247629 247644 +15
Branches 46688 46701 +13
=======================================
+ Hits 223618 223636 +18
- Misses 15469 15473 +4
+ Partials 8542 8535 -7
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mkdir()withrecursive: truereturns the first directory that was created. VFS passed the provider's return value straight through, so the path came back in the wrong namespace:RealFSProviderreturned an absolute path inside its root, leaking that root to the caller, and a mounted VFS returned a VFS-internal path without the mount point.Map the created path back through the provider and mount translations so the returned value is a path the caller can hand to
fsagain. This covers the sync, callback, and promises forms.