mirror of
https://github.com/fluxcd/flux2.git
synced 2026-05-23 09:55:55 +00:00
Merge 566bbe6e00 into fa7cd5f847
This commit is contained in:
commit
4273d6b33f
3 changed files with 13 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ import (
|
|||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
cryptssh "golang.org/x/crypto/ssh"
|
||||
|
|
@ -321,6 +322,10 @@ func LoadKeyPairFromPath(path, password string) (*ssh.KeyPair, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
if strings.HasPrefix(path, "~") {
|
||||
return nil, fmt.Errorf("failed to open private key file: path %q starts with '~' which is not expanded; use an absolute path or $HOME", path)
|
||||
}
|
||||
|
||||
b, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open private key file: %w", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue