Switches to use the new diffWith command

This commit is contained in:
Eric Amodio
2017-09-09 15:48:44 -04:00
parent a50f04c569
commit 9d83fbcacb
3 changed files with 36 additions and 34 deletions

View File

@@ -99,7 +99,8 @@ export class Git {
static async getVersionedFile(repoPath: string | undefined, fileName: string, branchOrSha: string) {
const data = await Git.show(repoPath, fileName, branchOrSha, 'binary');
const suffix = Git.isSha(branchOrSha) ? Git.shortenSha(branchOrSha) : branchOrSha;
// TODO: Sanitize the filename
const suffix = Git.isSha(branchOrSha) ? Git.shortenSha(branchOrSha) : branchOrSha.replace(/\\/g, '_').replace(/\//g, '_');
const ext = path.extname(fileName);
return new Promise<string>((resolve, reject) => {
tmp.file({ prefix: `${path.basename(fileName, ext)}-${suffix}__`, postfix: ext },