From d572f4324781d5b4200e1ad4d922880f19823605 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Wed, 8 Nov 2017 12:52:30 +0100 Subject: [PATCH] wip: git: send pngs as data uris --- extensions/git/src/commands.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index a78041e69bd..4aa9ccdd238 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -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('vscode.open', uri, opts); + return; + } + } + } + await commands.executeCommand('vscode.open', right, opts); + return; }