diff options
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/net.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/editors/code/src/net.ts b/editors/code/src/net.ts index 7c77530b8..866092882 100644 --- a/editors/code/src/net.ts +++ b/editors/code/src/net.ts | |||
@@ -1,8 +1,10 @@ | |||
1 | import fetch from "node-fetch"; | 1 | import fetch from "node-fetch"; |
2 | import * as vscode from "vscode"; | 2 | import * as vscode from "vscode"; |
3 | import * as stream from "stream"; | 3 | import * as stream from "stream"; |
4 | import * as crypto from "crypto"; | ||
4 | import * as fs from "fs"; | 5 | import * as fs from "fs"; |
5 | import * as util from "util"; | 6 | import * as util from "util"; |
7 | import * as path from "path"; | ||
6 | import { log, assert } from "./util"; | 8 | import { log, assert } from "./util"; |
7 | 9 | ||
8 | const pipeline = util.promisify(stream.pipeline); | 10 | const pipeline = util.promisify(stream.pipeline); |
@@ -68,7 +70,9 @@ interface DownloadOpts { | |||
68 | export async function download(opts: DownloadOpts) { | 70 | export async function download(opts: DownloadOpts) { |
69 | // Put artifact into a temporary file (in the same dir for simplicity) | 71 | // Put artifact into a temporary file (in the same dir for simplicity) |
70 | // to prevent partially downloaded files when user kills vscode | 72 | // to prevent partially downloaded files when user kills vscode |
71 | const tempFile = `${opts.dest}.tmp`; | 73 | const dest = path.parse(opts.dest); |
74 | const randomHex = crypto.randomBytes(5).toString("hex"); | ||
75 | const tempFile = path.join(dest.dir, `${dest.name}${randomHex}`); | ||
72 | 76 | ||
73 | await vscode.window.withProgress( | 77 | await vscode.window.withProgress( |
74 | { | 78 | { |