From ebfd5dc48011ae5a8a0598481d199333c2d682ae Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 7 Dec 2017 12:47:57 -0800 Subject: [PATCH] Revert c585fc65b72295513f4428ccead6d80ae93c0ac3 Fixes #39857 --- extensions/markdown/src/markdownEngine.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extensions/markdown/src/markdownEngine.ts b/extensions/markdown/src/markdownEngine.ts index d55e31362fd..436436a7c7c 100644 --- a/extensions/markdown/src/markdownEngine.ts +++ b/extensions/markdown/src/markdownEngine.ts @@ -138,18 +138,17 @@ export class MarkdownEngine { md.normalizeLink = (link: string) => { try { let uri = vscode.Uri.parse(link); - if (!uri.scheme && uri.path) { - let p = uri.path; + if (!uri.scheme && uri.path && !uri.fragment) { // Assume it must be a file - if (p[0] === '/') { + if (uri.path[0] === '/') { const root = vscode.workspace.getWorkspaceFolder(this.currentDocument); if (root) { - p = path.join(root.uri.fsPath, uri.path); + uri = vscode.Uri.file(path.join(root.uri.fsPath, uri.path)); } } else { - p = path.join(path.dirname(this.currentDocument.path), uri.path); + uri = vscode.Uri.file(path.join(path.dirname(this.currentDocument.path), uri.path)); } - return OpenDocumentLinkCommand.createCommandUri(p, uri.fragment).toString(); + return normalizeLink(uri.toString(true)); } } catch (e) { // noop -- GitLab