Skip to content

Commit 7067706

Browse files
committed
Fix tunnels with paths not working
1 parent 24c48c1 commit 7067706

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

cmd/root.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ func getPathPrompt() []*survey.Question {
9393
return errors.New(PathValidityErrorMsg)
9494
}
9595
},
96-
Transform: survey.TransformString(func(ans string) string {
97-
return fmt.Sprintf("'%s'", ans) //adding quotation marks to the given answer to prevent issues with spaces in paths
98-
}),
9996
},
10097
}
10198
}
@@ -246,7 +243,23 @@ func interactivePrompt() {
246243
arguments = append(arguments, "--basic-auth-username", basicAuth)
247244
}
248245
cmd.SetArgs(arguments)
249-
closehandler.SaveArguments(arguments)
246+
247+
var argumentsWithQuotes []string
248+
//setting the path argument in code doesn't work when it contains quotation marks,
249+
//but they do need to be there when entered as a standalone command in a command line if the path contains spaces
250+
//so, we give a copy of the arguments to the closehandler, with the path in quotation marks, where necessary
251+
if strings.Contains(exposePath, " ") {
252+
for i := 0; i < len(arguments); i++ {
253+
if arguments[i] == exposePath {
254+
argumentsWithQuotes = append(argumentsWithQuotes, fmt.Sprintf("'%s'", exposePath))
255+
} else {
256+
argumentsWithQuotes = append(argumentsWithQuotes, arguments[i])
257+
}
258+
}
259+
closehandler.SaveArguments(argumentsWithQuotes)
260+
} else {
261+
closehandler.SaveArguments(arguments)
262+
}
250263
cmd.Execute()
251264
}
252265

0 commit comments

Comments
 (0)