From 9437e15ceab719ff1c044f7a3f9e31d17f35f5a9 Mon Sep 17 00:00:00 2001 From: Tom Hofman <32954544+ausernamedtom@users.noreply.github.com> Date: Tue, 9 Jan 2024 09:07:18 +0100 Subject: [PATCH] fix: additional path escaping issue #80 (#81) --- plugin/mkcert/index.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugin/mkcert/index.ts b/plugin/mkcert/index.ts index 34fda04..8b6eb15 100644 --- a/plugin/mkcert/index.ts +++ b/plugin/mkcert/index.ts @@ -159,7 +159,7 @@ class Mkcert { } const mkcertBinary = await this.getMkcertBinary() - const commandStatement = `${mkcertBinary} -CAROOT` + const commandStatement = `${escape(mkcertBinary)} -CAROOT` debug(`Exec ${commandStatement}`) @@ -204,7 +204,7 @@ class Mkcert { await ensureDirExist(this.savePath) await this.retainExistedCA() - const cmd = `${mkcertBinary} -install -key-file ${escape( + const cmd = `${escape(mkcertBinary)} -install -key-file ${escape( this.keyFilePath )} -cert-file ${escape(this.certFilePath)} ${names}` @@ -255,13 +255,11 @@ class Mkcert { if (!sourceInfo) { const message = typeof this.sourceType === 'string' - ? `Unsupported platform. Unable to find a binary file for ${ - process.platform - } platform with ${process.arch} arch on ${ - this.sourceType === 'github' - ? 'https://github.com/FiloSottile/mkcert/releases' - : 'https://liuweigl.coding.net/p/github/artifacts?hash=8d4dd8949af543159c1b5ac71ff1ff72' - }` + ? `Unsupported platform. Unable to find a binary file for ${process.platform + } platform with ${process.arch} arch on ${this.sourceType === 'github' + ? 'https://github.com/FiloSottile/mkcert/releases' + : 'https://liuweigl.coding.net/p/github/artifacts?hash=8d4dd8949af543159c1b5ac71ff1ff72' + }` : 'Please check your custom "source", it seems to return invalid result' throw new Error(message) }