Skip to content

Commit 1af6486

Browse files
committed
Fix trying to open undefined certs
The issue is that cfg.get() is returning undefined, which becomes "undefined". Originally it was thought cfg.get() would return the default ("") but it seems that is not always the case. The trim is an extra addition in case the value is a string with just whitespace.
1 parent d8197ef commit 1af6486

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/extension.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
3838
const applyHttpProperties = () => {
3939
const cfg = vscode.workspace.getConfiguration()
4040
const insecure = Boolean(cfg.get("coder.insecure"))
41-
const certFile = String(cfg.get("coder.tlsCertFile"))
42-
const keyFile = String(cfg.get("coder.tlsKeyFile"))
43-
const caFile = String(cfg.get("coder.tlsCaFile"))
41+
const certFile = String(cfg.get("coder.tlsCertFile") ?? "").trim()
42+
const keyFile = String(cfg.get("coder.tlsKeyFile") ?? "").trim()
43+
const caFile = String(cfg.get("coder.tlsCaFile") ?? "").trim()
4444

4545
axios.defaults.httpsAgent = new https.Agent({
4646
cert: certFile === "" ? undefined : fs.readFileSync(certFile),

0 commit comments

Comments
 (0)