Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to 'Markdown Preview of relative links drops 'host' from path' #95092

Merged
merged 3 commits into from
Apr 13, 2020
Merged

Fix to 'Markdown Preview of relative links drops 'host' from path' #95092

merged 3 commits into from
Apr 13, 2020

Conversation

tweing
Copy link

@tweing tweing commented Apr 13, 2020

This PR fixes #93961.

Explanation

The URI class holds different information in the path property when the file was opened through a UNC location. For this fix I used the property fsPath instead of path in the onDidClickPreviewLink handler.

For a local file the URI class holds:
image

where as for a UNC opened file the URI class holds:
image

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:nose

Test the issue and the fix:

  1. To test this issue create two md files (see below this list).

  2. Open the readme.md file with an UNC path like "\\server\sharedfolder\readme.md".

  3. Open the preview of the markdown file readme.md.

  4. In the preview window, click on the Relative link to TEST.md link.

  5. The test.md file 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

@mjbvz mjbvz added this to the April 2020 milestone Apr 13, 2020
@mjbvz mjbvz merged commit b5136c0 into microsoft:master Apr 13, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 13, 2020

Thanks! This will be in the next insiders build and is scheduled for VS Code 1.45

@github-actions github-actions bot locked and limited conversation to collaborators May 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Markdown Preview of relative links drops 'host' from path
2 participants