1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Normalize ssh key paths for Windows file names

This commit is contained in:
Nick O'Leary 2018-02-27 10:58:54 +00:00
parent ce5242cfe8
commit e8fd7484b6
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -118,7 +118,7 @@ function generateSSHKey(username, options) {
var password = options.password || ""; var password = options.password || "";
var size = options.size || 2048; var size = options.size || 2048;
var sshKeyFileBasename = username + '_' + name; var sshKeyFileBasename = username + '_' + name;
var privateKeyFilePath = fspath.join(sshkeyDir, sshKeyFileBasename); var privateKeyFilePath = fs.normalize(fspath.join(sshkeyDir, sshKeyFileBasename));
return generateSSHKeyPair(name, privateKeyFilePath, comment, password, size) return generateSSHKeyPair(name, privateKeyFilePath, comment, password, size)
} }
}) })
@ -184,7 +184,7 @@ function generateSSHKeyPair(name, privateKeyPath, comment, password, size) {
function getPrivateKeyPath(username, name) { function getPrivateKeyPath(username, name) {
var sshKeyFileBasename = username + '_' + name; var sshKeyFileBasename = username + '_' + name;
var privateKeyFilePath = fspath.join(sshkeyDir, sshKeyFileBasename); var privateKeyFilePath = fspath.normalize(fspath.join(sshkeyDir, sshKeyFileBasename));
try { try {
fs.accessSync(privateKeyFilePath, (fs.constants || fs).R_OK); fs.accessSync(privateKeyFilePath, (fs.constants || fs).R_OK);
return privateKeyFilePath; return privateKeyFilePath;