mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
wip: git: send pngs as data uris
This commit is contained in:
@@ -184,7 +184,25 @@ export class CommandCenter {
|
||||
}
|
||||
|
||||
if (!left) {
|
||||
if (right.scheme === 'git') {
|
||||
const repository = this.model.getRepository(right);
|
||||
|
||||
if (repository) {
|
||||
const { path, ref } = fromGitUri(right);
|
||||
|
||||
if (/png$/i.test(path)) {
|
||||
const contents = await repository.show(ref, path);
|
||||
const buffer = new Buffer(contents);
|
||||
const uri = `data:data:image/png;base64,${buffer.toString('base64')}`;
|
||||
|
||||
await commands.executeCommand<void>('vscode.open', uri, opts);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await commands.executeCommand<void>('vscode.open', right, opts);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user