fix: allow hash character in paths#5122
Merged
lukekarrys merged 3 commits intonpm:latestfrom Jul 27, 2022
AgainPsychoX:againpsychox/allow-hash-in-paths
Merged
fix: allow hash character in paths#5122lukekarrys merged 3 commits intonpm:latestfrom AgainPsychoX:againpsychox/allow-hash-in-paths
lukekarrys merged 3 commits intonpm:latestfrom
AgainPsychoX:againpsychox/allow-hash-in-paths
Conversation
AgainPsychoX
commented
Jul 4, 2022
lukekarrys
approved these changes
Jul 27, 2022
Contributor
|
Looks good, thanks for the fix! It's possible in the future we may want a standardized way of doing this. We've had mixed luck with small utils to do stuff like this, so this is great for now. Just commenting in case we want to DRY it up in the future. |
Merged
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.
Allow hash character in paths
Insteadfile:${...}we need to usepathToFileURL(fromnode:url) because some paths can contain hash character (#) or other characters (I guess, question mark (?) could also be a problem) that are cut off when the URI (file:schema) points file to be accessed by file system.The
file:${...}instances would need replacing hash character (#) with its URI encoded value (%23) to prevent it being reparsed along the way. My previous idea of usingpathToFileURLwouldn't work, as relative paths got pre-resolved before converting to URL, i.e.file:../hellowith CWD ofS:\\test\\directorywould becamefile://S:\\test\\hellowhile some instances of code (NPA) expected not unresolvedfile:..\\hello. Aside of that, simply replacing the char would be faster. By the way, I am almost certain that the hash character is the only "weird" character that could be used in the paths, as question mark (despite being beginning of query params) hardly can't nor should be used for names (Windows disallows).References
Fixes #5120
Pending work
file:was used and if similar patch could be applied.