Skip to content

Commit 58bcd80

Browse files
committed
abs keypath fix
1 parent 8690d29 commit 58bcd80

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cmd/graft/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func main() {
2121
if len(args) > 0 {
2222
arg := args[0]
2323
if arg == "-v" || arg == "--version" {
24-
fmt.Println("v2.3.2")
24+
fmt.Println("v2.4.2")
2525
return
2626
}
2727
if arg == "--help" {

internal/prompt/prompt.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,13 @@ func PromptNewServer(reader *bufio.Reader) (string, int, string, string) {
130130
keyPath, _ := reader.ReadString('\n')
131131
keyPath = strings.TrimSpace(keyPath)
132132
//if key path starts with ./ then dow pwd and marge to find absolute keypath
133-
keyPath, err := filepath.Abs(keyPath)
134-
if err != nil {
135-
fmt.Println("Error getting absolute path:", err)
136-
return host, port, user, keyPath
133+
if strings.HasPrefix(keyPath, "./") {
134+
absPath, err := filepath.Abs(keyPath)
135+
if err != nil {
136+
fmt.Println("Error getting absolute path:", err)
137+
return host, port, user, keyPath
138+
}
139+
keyPath = absPath
137140
}
138141

139142
return host, port, user, keyPath

0 commit comments

Comments
 (0)