Skip to content

Commit bfdf35c

Browse files
committed
Supply default KeygenPath in SSH key parser
This allows the parser to be used even if it's not configured (useful for automatic tests). Signed-off-by: Leon M. Busch-George <[email protected]>
1 parent 56e0720 commit bfdf35c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

models/asymkey/ssh_key_parse.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,12 @@ func SSHKeyGenParsePublicKey(key string) (string, int, error) {
285285
}
286286
}()
287287

288-
stdout, stderr, err := process.GetManager().Exec("SSHKeyGenParsePublicKey", setting.SSH.KeygenPath, "-lf", tmpName)
288+
keygenPath := setting.SSH.KeygenPath
289+
if len(keygenPath) == 0 {
290+
keygenPath = "ssh-keygen"
291+
}
292+
293+
stdout, stderr, err := process.GetManager().Exec("SSHKeyGenParsePublicKey", keygenPath, "-lf", tmpName)
289294
if err != nil {
290295
return "", 0, fmt.Errorf("fail to parse public key: %s - %s", err, stderr)
291296
}

0 commit comments

Comments
 (0)