fixed #5797 - verified host keys not saving

This commit is contained in:
Eugene Pankov 2022-02-21 09:01:55 +01:00
parent a2929309d9
commit 50304d151a
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
2 changed files with 4 additions and 3 deletions

View File

@ -32,8 +32,8 @@ export class HostKeyPromptModalComponent {
this.modalInstance.close(true) this.modalInstance.close(true)
} }
acceptAndSave () { async acceptAndSave () {
this.knownHosts.store(this.selector, this.digest) await this.knownHosts.store(this.selector, this.digest)
this.accept() this.accept()
} }

View File

@ -21,12 +21,13 @@ export class SSHKnownHostsService {
return this.config.store.ssh.knownHosts.find(x => x.host === selector.host && x.port === selector.port && x.type === selector.type) ?? null return this.config.store.ssh.knownHosts.find(x => x.host === selector.host && x.port === selector.port && x.type === selector.type) ?? null
} }
store (selector: KnownHostSelector, digest: string): void { async store (selector: KnownHostSelector, digest: string): Promise<void> {
const existing = this.getFor(selector) const existing = this.getFor(selector)
if (existing) { if (existing) {
existing.digest = digest existing.digest = digest
} else { } else {
this.config.store.ssh.knownHosts.push({ ...selector, digest }) this.config.store.ssh.knownHosts.push({ ...selector, digest })
} }
this.config.save()
} }
} }