From 4a515d94327b29ed90329b4e213b19676931c1b3 Mon Sep 17 00:00:00 2001 From: mannjani <4688839+mannjani@users.noreply.github.com> Date: Wed, 5 Mar 2025 13:58:31 +0530 Subject: [PATCH] Add support for %h and %r escape characters in IdentityFile for SSH. (#10343) * Add support for %h and %r escape characters in IdentityFile for SSH. See section "IdentityFile" on https://linux.die.net/man/5/ssh_config for details. * Fix lint warnings. --- tabby-ssh/src/session/ssh.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tabby-ssh/src/session/ssh.ts b/tabby-ssh/src/session/ssh.ts index fd489d28..65e13559 100644 --- a/tabby-ssh/src/session/ssh.ts +++ b/tabby-ssh/src/session/ssh.ts @@ -162,9 +162,11 @@ export class SSHSession { this.allAuthMethods = [{ type: 'none' }] if (!this.profile.options.auth || this.profile.options.auth === 'publicKey') { if (this.profile.options.privateKeys?.length) { - for (const pk of this.profile.options.privateKeys) { + for (let pk of this.profile.options.privateKeys) { // eslint-disable-next-line @typescript-eslint/init-declarations let contents: Buffer + pk = pk.replace('%h', this.profile.options.host) + pk = pk.replace('%r', this.profile.options.user) try { contents = await this.fileProviders.retrieveFile(pk) } catch (error) {