Fix to 'Markdown Preview of relative links drops 'host' from path'#95092
Merged
mjbvz merged 3 commits intomicrosoft:masterfrom Apr 13, 2020
tweing:master
Merged
Fix to 'Markdown Preview of relative links drops 'host' from path'#95092mjbvz merged 3 commits intomicrosoft:masterfrom tweing:master
mjbvz merged 3 commits intomicrosoft:masterfrom
tweing:master
Conversation
Collaborator
|
Thanks! This will be in the next insiders build and is scheduled for VS Code 1.45 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR fixes #93961.
Explanation
The
URIclass holds different information in thepathproperty when the file was opened through a UNC location. For this fix I used the propertyfsPathinstead ofpathin theonDidClickPreviewLinkhandler.For a local file the

URIclass holds:where as for a UNC opened file the

URIclass holds:Here is an excerpt from
uri.ts:foo://example.com:8042/over/there?name=ferret#nose \_/ \______________/\_________/ \_________/ \__/ | | | | | scheme authority path query fragment | _____________________|__ / \ / \ urn:example:animal:ferret:noseTest the issue and the fix:
To test this issue create two md files (see below this list).
Open the
readme.mdfile with an UNC path like"\\server\sharedfolder\readme.md".Open the preview of the markdown file
readme.md.In the preview window, click on the
Relative link to TEST.mdlink.The
test.mdfile should open in the preview. Without the fix, an error message is being shown.Test files
readme.md:
Here's a link: [Relative link to TEST.md](TEST.md)test.md:
This is the test markdown file