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>
pull/6418/head
shayne 2 years ago committed by GitHub
parent d1e1c025b0
commit bdd8ce6692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -285,6 +285,9 @@ func (e *serveEnv) runServe(ctx context.Context, args []string) error {
}
h.Proxy = t
case "text":
if args[2] == "" {
return errors.New("unable to serve; text cannot be an empty string")
}
h.Text = args[2]
default:
fmt.Fprintf(os.Stderr, "error: unknown serve type %q\n\n", args[1])

Loading…
Cancel
Save