doc: clarify fs string paths are not parsed as URLs#64531
Open
soreavis wants to merge 1 commit into
Open
Conversation
The String paths section does not say that a string beginning with file: is treated as a literal path rather than a file: URL, which regularly surprises users. State it explicitly and point to URL objects for file: URL support. Fixes: nodejs#36585 Signed-off-by: Julian Soreavis <julian.soreavis@gmail.com>
|
Thanks for suggesting the fix! This was so long ago that I had forgotten about it. My concern is that describing the behaviour in the notes means that a reader is still likely to miss it. Ideally the But I would suggest merging this as a first step. |
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.
The String paths section doesn't mention that a string beginning with
file:is treated as a literal path, not parsed as a URL — the confusion in #36585, where maintainers invited a clarifying addition. This adds one paragraph stating the behavior, what actually happens on POSIX, and points toURLobjects forfile:URL support. Verified againstgetValidatedPath/toPathIfFileURL(strings are never URL-parsed anywhere innode:fs) and by running thefile:directory repro from the issue on currentmain. I used an AI assistant while researching and drafting this change; I've verified the behavior and the wording against the source myself and take full responsibility for it.Fixes: #36585