Handle normalized absolute file paths on markdown preview link click #116649
Handle normalized absolute file paths on markdown preview link click #116649mjbvz merged 2 commits into
Conversation
| hrefPath = path.join(path.dirname(this.resource.fsPath), hrefPath); | ||
| } else { | ||
| // Handle any normalized file paths | ||
| hrefPath = hrefPath.replace('file///', ''); |
There was a problem hiding this comment.
After investigation, I noticed that this issue was caused inadvertently by https://github.com/microsoft/vscode/pull/114553/files where the links were normalised to display images. This fix handles both absolute links and file:/// links
There was a problem hiding this comment.
On windows, I think the file path will look like file://c/path/to/file. Try parsing the file path using vscode.Uri.parse and then getting the .fsPath from it instead. I think that should be safer but haven't tested
| hrefPath = path.join(path.dirname(this.resource.fsPath), hrefPath); | ||
| } else { | ||
| // Handle any normalized file paths | ||
| hrefPath = hrefPath.replace('file///', ''); |
There was a problem hiding this comment.
On windows, I think the file path will look like file://c/path/to/file. Try parsing the file path using vscode.Uri.parse and then getting the .fsPath from it instead. I think that should be safer but haven't tested
|
Thanks! Will be in the next insiders build and is scheduled for VS Code 1.54 |

This PR fixes #115812