提交 b8747ec0 编写于 作者: J Joao Moreno

🐛 use fsPath when getting paths out of URIs

fixes #23297
上级 61753c02
......@@ -60,7 +60,11 @@ export class GitContentProvider {
this.cache[cacheKey] = cacheValue;
if (uri.scheme === 'git-original') {
uri = new Uri().with({ scheme: 'git', path: uri.query });
try {
return await this.model.show('', uri.query);
} catch (err) {
return '';
}
}
let ref = uri.query;
......@@ -73,8 +77,7 @@ export class GitContentProvider {
}
try {
const result = await this.model.show(ref, uri);
return result;
return await this.model.show(ref, uri.fsPath);
} catch (err) {
return '';
}
......
......@@ -483,9 +483,9 @@ export class Model implements Disposable {
});
}
async show(ref: string, uri: Uri): Promise<string> {
async show(ref: string, filePath: string): Promise<string> {
return await this.run(Operation.Show, async () => {
const relativePath = path.relative(this.repository.root, uri.fsPath).replace(/\\/g, '/');
const relativePath = path.relative(this.repository.root, filePath).replace(/\\/g, '/');
const result = await this.repository.git.exec(this.repository.root, ['show', `${ref}:${relativePath}`]);
if (result.exitCode !== 0) {
......
......@@ -101,7 +101,11 @@ export class GitSCMProvider {
// As a mitigation for extensions like ESLint showing warnings and errors
// for git URIs, let's change the file extension of these uris to .git.
return new Uri().with({ scheme: 'git-original', query: uri.path, path: uri.path + '.git' });
return new Uri().with({
scheme: 'git-original',
query: uri.fsPath,
path: uri.path + '.git'
});
}
private onDidModelChange(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册