Selaa lähdekoodia

fix: adjust ssh config time resolution (#10803)

Co-authored-by: Copilot <[email protected]>
osm1892 3 viikkoa sitten
vanhempi
sitoutus
bbcb026433
1 muutettua tiedostoa jossa 16 lisäystä ja 2 poistoa
  1. 16 2
      tabby-electron/src/sshImporters.ts

+ 16 - 2
tabby-electron/src/sshImporters.ts

@@ -205,9 +205,7 @@ function convertHostToSSHProfile (host: string, settings: Record<string, string
 
             // The following have single integer values
             case SSHProfilePropertyNames.Port:
-            case SSHProfilePropertyNames.KeepaliveInterval:
             case SSHProfilePropertyNames.KeepaliveCountMax:
-            case SSHProfilePropertyNames.ReadyTimeout:
                 const numberString = settings[key]
                 if (typeof numberString === 'string') {
                     options[targetName] = parseInt(numberString, 10)
@@ -216,6 +214,22 @@ function convertHostToSSHProfile (host: string, settings: Record<string, string
                 }
                 break
 
+            // KeepaliveInterval and ReadyTimeout are in seconds in SSH config but milliseconds in Tabby
+            case SSHProfilePropertyNames.KeepaliveInterval:
+            case SSHProfilePropertyNames.ReadyTimeout:
+                const secondsString = settings[key]
+                if (typeof secondsString === 'string') {
+                    const parsedSeconds = parseInt(secondsString, 10)
+                    if (!isNaN(parsedSeconds) && parsedSeconds >= 0) {
+                        options[targetName] = parsedSeconds * 1000
+                    } else {
+                        console.log(`Invalid value for ${key}: "${secondsString}"`)
+                    }
+                } else {
+                    console.log('Unexpected value in settings for ' + key)
+                }
+                break
+
             // The following have single yes/no values
             case SSHProfilePropertyNames.X11:
             case SSHProfilePropertyNames.AgentForward: