extract username from putty hostname if not set

pull/65/head
Jakob Schrettenbrunner 6 years ago
parent 722b7f3283
commit 298bbd9b9c

@ -41,6 +41,9 @@ export async function calculateActualConfig(config: FileSystemConfig): Promise<F
if (!session) throw new Error(`Couldn't find the requested PuTTY session`);
if (session.protocol !== 'ssh') throw new Error(`The requested PuTTY session isn't a SSH session`);
config.username = config.username || session.username;
if (!config.username && session.hostname && session.hostname.indexOf('@') >= 1) {
config.username = session.hostname.substr(0, session.hostname.indexOf('@'));
}
config.host = config.host || session.hostname;
config.port = session.portnumber || config.port;
config.agent = config.agent || (session.tryagent ? 'pageant' : undefined);

Loading…
Cancel
Save