@@ -613,8 +613,9 @@ struct ConnectionFormView: View { // swiftlint:disable:this type_body_length
613613
614614 private func reloadProfiles( ) {
615615 sshProfiles = SSHProfileStorage . shared. loadProfiles ( )
616- // If the edited/deleted profile no longer exists, clear the selection
617- if let id = sshProfileId, !sshProfiles. contains ( where: { $0. id == id } ) {
616+ if let id = sshProfileId,
617+ !SSHProfileStorage. shared. lastLoadFailed,
618+ !sshProfiles. contains ( where: { $0. id == id } ) {
618619 sshProfileId = nil
619620 }
620621 }
@@ -1176,21 +1177,27 @@ struct ConnectionFormView: View { // swiftlint:disable:this type_body_length
11761177 }
11771178
11781179 private func saveConnection( ) {
1179- let sshConfig = SSHConfiguration (
1180- enabled: sshEnabled,
1181- host: sshHost,
1182- port: Int ( sshPort) ?? 22 ,
1183- username: sshUsername,
1184- authMethod: sshAuthMethod,
1185- privateKeyPath: sshPrivateKeyPath,
1186- useSSHConfig: !selectedSSHConfigHost. isEmpty,
1187- agentSocketPath: resolvedSSHAgentSocketPath,
1188- jumpHosts: jumpHosts,
1189- totpMode: totpMode,
1190- totpAlgorithm: totpAlgorithm,
1191- totpDigits: totpDigits,
1192- totpPeriod: totpPeriod
1193- )
1180+ let sshConfig : SSHConfiguration
1181+ if let profileId = sshProfileId,
1182+ let profile = sshProfiles. first ( where: { $0. id == profileId } ) {
1183+ sshConfig = profile. toSSHConfiguration ( )
1184+ } else {
1185+ sshConfig = SSHConfiguration (
1186+ enabled: sshEnabled,
1187+ host: sshHost,
1188+ port: Int ( sshPort) ?? 22 ,
1189+ username: sshUsername,
1190+ authMethod: sshAuthMethod,
1191+ privateKeyPath: sshPrivateKeyPath,
1192+ useSSHConfig: !selectedSSHConfigHost. isEmpty,
1193+ agentSocketPath: resolvedSSHAgentSocketPath,
1194+ jumpHosts: jumpHosts,
1195+ totpMode: totpMode,
1196+ totpAlgorithm: totpAlgorithm,
1197+ totpDigits: totpDigits,
1198+ totpPeriod: totpPeriod
1199+ )
1200+ }
11941201
11951202 let sslConfig = SSLConfiguration (
11961203 mode: sslMode,
0 commit comments