Skip to content

Commit bd87882

Browse files
bors[bot]wxb1ank
andauthored
Merge #9281
9281: fix: Code: use `Uri.toString()` for URLs r=lnicola a=wxb1ank I believe this should fix #9280. Testing is needed but I wanted to quickly push a hotfix. Co-authored-by: wxb1ank <[email protected]>
2 parents 447d849 + 7a8a72c commit bd87882

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

editors/code/src/net.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,19 @@ async function downloadFile(
127127
httpProxy: string | null | undefined,
128128
onProgress: (readBytes: number, totalBytes: number) => void
129129
): Promise<void> {
130+
const urlString = url.toString();
131+
130132
const res = await (() => {
131133
if (httpProxy) {
132-
log.debug(`Downloading ${url.path} via proxy: ${httpProxy}`);
133-
return fetch(url.path, { agent: new HttpsProxyAgent(httpProxy) });
134+
log.debug(`Downloading ${urlString} via proxy: ${httpProxy}`);
135+
return fetch(urlString, { agent: new HttpsProxyAgent(httpProxy) });
134136
}
135137

136-
return fetch(url.path);
138+
return fetch(urlString);
137139
})();
138140

139141
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);
141143
log.error({ body: await res.text(), headers: res.headers });
142144

143145
throw new Error(`Got response ${res.status} when trying to download a file.`);
@@ -146,7 +148,7 @@ async function downloadFile(
146148
const totalBytes = Number(res.headers.get('content-length'));
147149
assert(!Number.isNaN(totalBytes), "Sanity check of content-length protocol");
148150

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);
150152

151153
let readBytes = 0;
152154
res.body.on("data", (chunk: Buffer) => {

0 commit comments

Comments
 (0)