diff options
| author | Shayne Sweeney <shayne@tailscale.com> | 2022-11-20 12:02:47 -0500 |
|---|---|---|
| committer | Shayne Sweeney <shayne@tailscale.com> | 2022-11-20 12:56:12 -0500 |
| commit | 1ceaabbc7b5ded52d02ae01f9c89a47c8a4db922 (patch) | |
| tree | 7ff484fedcf191e4fa3be292ac201c504db406fc /ipn/ipn_view.go | |
| parent | 538f431d5d9eda4d40d07f346eca7f9eaf3d9869 (diff) | |
| download | tailscale-shayne/serve_empty_text_handler.tar.xz tailscale-shayne/serve_empty_text_handler.zip | |
cmd/tailscale/cli: allow empty text ("") serveshayne/serve_empty_text_handler
Current behavior is broken. `tailscale serve text / ""` returns no error
and shows up in `tailscale serve status` but requests return a 500
"empty handler".
The commit changes the handler field `Text` to type of `*string`.
Closes #6405
Signed-off-by: Shayne Sweeney <shayne@tailscale.com>
Diffstat (limited to 'ipn/ipn_view.go')
| -rw-r--r-- | ipn/ipn_view.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ipn/ipn_view.go b/ipn/ipn_view.go index c117148da..5ec360e73 100644 --- a/ipn/ipn_view.go +++ b/ipn/ipn_view.go @@ -290,13 +290,19 @@ func (v *HTTPHandlerView) UnmarshalJSON(b []byte) error { func (v HTTPHandlerView) Path() string { return v.ж.Path } func (v HTTPHandlerView) Proxy() string { return v.ж.Proxy } -func (v HTTPHandlerView) Text() string { return v.ж.Text } +func (v HTTPHandlerView) Text() *string { + if v.ж.Text == nil { + return nil + } + x := *v.ж.Text + return &x +} // A compilation failure here means this code must be regenerated, with the command at the top of this file. var _HTTPHandlerViewNeedsRegeneration = HTTPHandler(struct { Path string Proxy string - Text string + Text *string }{}) // View returns a readonly view of WebServerConfig. |
