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:
parent
2ed52820b6
commit
7ef418ec52
@ -187,16 +187,18 @@ function getPrivateKeyPath(username, name) {
|
|||||||
var privateKeyFilePath = fspath.normalize(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;
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
privateKeyFilePath = fspath.join(userSSHKeyDir,name);
|
privateKeyFilePath = fspath.join(userSSHKeyDir,name);
|
||||||
try {
|
try {
|
||||||
fs.accessSync(privateKeyFilePath, (fs.constants || fs).R_OK);
|
fs.accessSync(privateKeyFilePath, (fs.constants || fs).R_OK);
|
||||||
return privateKeyFilePath;
|
|
||||||
} catch(err2) {
|
} catch(err2) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fspath.sep === '\\') {
|
||||||
|
privateKeyFilePath = privateKeyFilePath.replace(/\\/g,'\\\\');
|
||||||
|
}
|
||||||
|
return privateKeyFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Loading…
Reference in New Issue
Block a user