Skip to content

Commit b0c7ff1

Browse files
committed
Fix wrong path on macOS
This may fix issue #28 but requires more tests on Windows
1 parent 770a5b5 commit b0c7ff1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

certs.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ function mkcert(appDataPath, exe, domain) {
7979
// use apex on Windows
8080
if (process.platform === "win32")
8181
return "\"" + path + "\""
82-
// escape spaces in Mac OS
82+
// escape spaces (not already escaped) in Mac OS
8383
if (process.platform === "darwin")
84-
return path.replace(/ /g, "\\ ")
84+
return path.replace(/(?<!\\) /g, "\\ ")
8585
return path
8686
}
8787

88-
const logPath = ensureValidPath(path.join(appDataPath, "mkcert.log"))
89-
const errPath = ensureValidPath(path.join(appDataPath, "mkcert.err"))
88+
const logPath = path.join(appDataPath, "mkcert.log") // do not escape: fs.writeFile doesn't want an escaped path
89+
const errPath = path.join(appDataPath, "mkcert.err") // do not escape: fs.writeFile doesn't want an escaped path
9090
const exePath = ensureValidPath(path.join(appDataPath, exe))
9191
const crtPath = ensureValidPath(path.join(appDataPath, domain + ".crt"))
9292
const keyPath = ensureValidPath(path.join(appDataPath, domain + ".key"))

0 commit comments

Comments
 (0)