wip: git: send pngs as data uris

This commit is contained in:
Joao Moreno
2017-11-08 12:52:30 +01:00
parent 1a595ca4a1
commit d572f43247
+18
View File
@@ -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;
}