From 06c242eb01632c4b71e5f838be3a317604a2869f Mon Sep 17 00:00:00 2001 From: silentrald Date: Sat, 21 Jun 2025 19:54:04 +0800 Subject: [PATCH] [fix] fixed issue with double http prepending on http proxy (#889) --- src/main/helpers/proxy.helpers.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/helpers/proxy.helpers.ts b/src/main/helpers/proxy.helpers.ts index 0a102b13..98175230 100644 --- a/src/main/helpers/proxy.helpers.ts +++ b/src/main/helpers/proxy.helpers.ts @@ -51,7 +51,15 @@ async function enableWindowsProxy(enable: boolean): Promise { } if (enable) { - const httpProxyUrl = `http://${await getProxyServer().catch(err => log.error(err))}` + const httpProxyServer = await getProxyServer().catch(err => log.error(err)); + let httpProxyUrl: string | null = null; + if (httpProxyServer) { + // Prepend the http protocol + httpProxyUrl = httpProxyServer.startsWith("http://") + ? httpProxyServer + : `http://${httpProxyServer}`; + } + globalProxyAgent.HTTP_PROXY = httpProxyUrl; globalProxyAgent.HTTPS_PROXY = httpProxyUrl; globalProxyAgent.NO_PROXY = `${await getProxyOverride().catch(err => log.error(err))}`;