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

Ensure sshkey file path is properly escaped on Windows

This commit is contained in:
Nick O'Leary 2018-02-27 13:05:10 +00:00
parent 2ed52820b6
commit 7ef418ec52
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -187,16 +187,18 @@ function getPrivateKeyPath(username, name) {
var privateKeyFilePath = fspath.normalize(fspath.join(sshkeyDir, sshKeyFileBasename));
try {
fs.accessSync(privateKeyFilePath, (fs.constants || fs).R_OK);
return privateKeyFilePath;
} catch(err) {
privateKeyFilePath = fspath.join(userSSHKeyDir,name);
try {
fs.accessSync(privateKeyFilePath, (fs.constants || fs).R_OK);
return privateKeyFilePath;
} catch(err2) {
return null;
}
}
if (fspath.sep === '\\') {
privateKeyFilePath = privateKeyFilePath.replace(/\\/g,'\\\\');
}
return privateKeyFilePath;
}
module.exports = {