-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Handle normalized absolute file paths on markdown preview link click #116649
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
Handle normalized absolute file paths on markdown preview link click #116649
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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