aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/package.json4
-rw-r--r--editors/code/src/net.ts12
2 files changed, 9 insertions, 7 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 0f3ed48a0..a88a5c44e 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -389,7 +389,7 @@
389 "default": {}, 389 "default": {},
390 "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`" 390 "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`"
391 }, 391 },
392 "$generated-start": false, 392 "$generated-start": {},
393 "rust-analyzer.assist.importGranularity": { 393 "rust-analyzer.assist.importGranularity": {
394 "markdownDescription": "How imports should be grouped into use statements.", 394 "markdownDescription": "How imports should be grouped into use statements.",
395 "default": "crate", 395 "default": "crate",
@@ -841,7 +841,7 @@
841 "Search for all symbols kinds" 841 "Search for all symbols kinds"
842 ] 842 ]
843 }, 843 },
844 "$generated-end": false 844 "$generated-end": {}
845 } 845 }
846 }, 846 },
847 "problemPatterns": [ 847 "problemPatterns": [
diff --git a/editors/code/src/net.ts b/editors/code/src/net.ts
index 747c02db9..5c48c74e8 100644
--- a/editors/code/src/net.ts
+++ b/editors/code/src/net.ts
@@ -127,17 +127,19 @@ async function downloadFile(
127 httpProxy: string | null | undefined, 127 httpProxy: string | null | undefined,
128 onProgress: (readBytes: number, totalBytes: number) => void 128 onProgress: (readBytes: number, totalBytes: number) => void
129): Promise<void> { 129): Promise<void> {
130 const urlString = url.toString();
131
130 const res = await (() => { 132 const res = await (() => {
131 if (httpProxy) { 133 if (httpProxy) {
132 log.debug(`Downloading ${url.path} via proxy: ${httpProxy}`); 134 log.debug(`Downloading ${urlString} via proxy: ${httpProxy}`);
133 return fetch(url.path, { agent: new HttpsProxyAgent(httpProxy) }); 135 return fetch(urlString, { agent: new HttpsProxyAgent(httpProxy) });
134 } 136 }
135 137
136 return fetch(url.path); 138 return fetch(urlString);
137 })(); 139 })();
138 140
139 if (!res.ok) { 141 if (!res.ok) {
140 log.error("Error", res.status, "while downloading file from", url.path); 142 log.error("Error", res.status, "while downloading file from", urlString);
141 log.error({ body: await res.text(), headers: res.headers }); 143 log.error({ body: await res.text(), headers: res.headers });
142 144
143 throw new Error(`Got response ${res.status} when trying to download a file.`); 145 throw new Error(`Got response ${res.status} when trying to download a file.`);
@@ -146,7 +148,7 @@ async function downloadFile(
146 const totalBytes = Number(res.headers.get('content-length')); 148 const totalBytes = Number(res.headers.get('content-length'));
147 assert(!Number.isNaN(totalBytes), "Sanity check of content-length protocol"); 149 assert(!Number.isNaN(totalBytes), "Sanity check of content-length protocol");
148 150
149 log.debug("Downloading file of", totalBytes, "bytes size from", url.path, "to", destFilePath.path); 151 log.debug("Downloading file of", totalBytes, "bytes size from", urlString, "to", destFilePath.path);
150 152
151 let readBytes = 0; 153 let readBytes = 0;
152 res.body.on("data", (chunk: Buffer) => { 154 res.body.on("data", (chunk: Buffer) => {