Fix file relative path link (#181475)

* Fix for file link with relative path

* Removed redundant comments

* Simplify fix to accomodate Windows paths

---------

Co-authored-by: Sidebail <vova.vatsurin@gmail.com>
Co-authored-by: Alexandru Dima <alexdima@microsoft.com>
This commit is contained in:
VLADIMIR VATSURIN 2024-03-20 16:19:26 -04:00 committed by GitHub
parent abd11f059e
commit 5af7860ca2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -237,9 +237,9 @@ export class LinkDetector extends Disposable implements IEditorContribution {
const fsPath = resources.originalFSPath(parsedUri);
let relativePath: string | null = null;
if (fsPath.startsWith('/./')) {
if (fsPath.startsWith('/./') || fsPath.startsWith('\\.\\')) {
relativePath = `.${fsPath.substr(1)}`;
} else if (fsPath.startsWith('//./')) {
} else if (fsPath.startsWith('//./') || fsPath.startsWith('\\\\.\\')) {
relativePath = `.${fsPath.substr(2)}`;
}