mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Handle globalAgent having a single non-array CA
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
0eee5a07c5
commit
386cf3b87b
@ -22,15 +22,30 @@ const injectSystemCAsInjectable = getInjectable({
|
|||||||
const requestSystemCAs = di.inject(requestSystemCAsInjectionToken);
|
const requestSystemCAs = di.inject(requestSystemCAsInjectionToken);
|
||||||
|
|
||||||
return async () => {
|
return async () => {
|
||||||
for (const cert of await requestSystemCAs()) {
|
const certs = await requestSystemCAs();
|
||||||
if (isCertActive(cert)) {
|
|
||||||
if (Array.isArray(globalAgent.options.ca) && !globalAgent.options.ca.includes(cert)) {
|
if (certs.length === 0) {
|
||||||
globalAgent.options.ca.push(cert);
|
// Leave the global option alone
|
||||||
} else {
|
return;
|
||||||
globalAgent.options.ca = [cert];
|
}
|
||||||
}
|
|
||||||
|
const cas = Array.isArray(globalAgent.options.ca)
|
||||||
|
? globalAgent.options.ca
|
||||||
|
: globalAgent.options.ca
|
||||||
|
? [globalAgent.options.ca]
|
||||||
|
: [];
|
||||||
|
|
||||||
|
for (const cert of certs) {
|
||||||
|
if (!isCertActive(cert)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cas.includes(cert)) {
|
||||||
|
cas.push(cert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalAgent.options.ca = cas;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user