From d0416a783fb36a0830a6d9921e523946d48ed977 Mon Sep 17 00:00:00 2001 From: "Hung-Han (Henry) Chen" Date: Tue, 2 Nov 2021 16:54:05 +0200 Subject: [PATCH] Revert https://github.com/lensapp/lens/pull/4185#discussion_r740466873 Signed-off-by: Hung-Han (Henry) Chen --- src/common/system-ca.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/system-ca.ts b/src/common/system-ca.ts index dfead212ae..904ec01b97 100644 --- a/src/common/system-ca.ts +++ b/src/common/system-ca.ts @@ -76,10 +76,13 @@ export function getWinRootCA(): Promise { * Add (or merge) CAs to https.globalAgent.options.ca */ export function injectCAs(CAs: string[]) { - const oldCAs = [https.globalAgent.options.ca].flat(); - const injectedCAs = new Set([...oldCAs, ...CAs]); - - https.globalAgent.options.ca = [...injectedCAs]; + for (const cert of CAs) { + if (Array.isArray(https.globalAgent.options.ca) && !https.globalAgent.options.ca.includes(cert)) { + https.globalAgent.options.ca.push(cert); + } else { + https.globalAgent.options.ca = [cert]; + } + } } /**