mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-22 12:58:37 +00:00
cmd/tailscale/cli: disallow empty text "" from serve CLI (#6416)
Current behavior is broken. tailscale serve text / "" returns no error and shows up in tailscale serve status but requests return a 500 "empty handler". Adds an error if the user passes in an empty string for the text handler. Closes #6405 Signed-off-by: Shayne Sweeney <shayne@tailscale.com>
This commit is contained in:
parent
d1e1c025b0
commit
bdd8ce6692
@ -285,6 +285,9 @@ func (e *serveEnv) runServe(ctx context.Context, args []string) error {
|
|||||||
}
|
}
|
||||||
h.Proxy = t
|
h.Proxy = t
|
||||||
case "text":
|
case "text":
|
||||||
|
if args[2] == "" {
|
||||||
|
return errors.New("unable to serve; text cannot be an empty string")
|
||||||
|
}
|
||||||
h.Text = args[2]
|
h.Text = args[2]
|
||||||
default:
|
default:
|
||||||
fmt.Fprintf(os.Stderr, "error: unknown serve type %q\n\n", args[1])
|
fmt.Fprintf(os.Stderr, "error: unknown serve type %q\n\n", args[1])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user