liuweiGL / vite-plugin-mkcert

Provide certificates for vite's https dev service.
https://www.npmjs.com/package/vite-plugin-mkcert
MIT License
585 stars 38 forks source link

Can't create certificate if homedirectory (or username) contains a space #17

Closed bee100 closed 2 years ago

bee100 commented 3 years ago

Describe the bug

When the active user has a space in the username and mkcert is added as plugin in the Config and the user runs npm run dev, the command to install the certificate will fail

Suggestion: escape the key file path and cert file path in line 142 of this file: /packages/plugin/src/mkcert/index.ts

"const cmd = ${mkcertBinnary} -install -key-file ${KEY_FILE_PATH} -cert-file ${CERT_FILE_PATH} ${hostlist}"

Reproduction

Logs

error when starting dev server: Error: Command failed: C:\Users\Test Space.vite-plugin-mkcert\mkcert.exe -install -key-file C:\Users\Test Space.vite-plugin-mkcert\certs\dev.key -cert-file C:\Users\Test Space.vite-plugin-mkcert\certs\dev.pem localhost {ip1} {ip2} 127.0.0.1 {ip3} 'C:\Users\Test' is not recognized as an internal or external command,