ipn/ipnlocal: move LocalBackend.validPopBrowserURL empty check from caller

I was too late with review feedback to 513780f4f8.

Updates tailscale/corp#7948

Change-Id: I8fa3b4eba4efaff591a2d0bfe6ab4795638b7c3a
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/6353/head
Brad Fitzpatrick 2 years ago committed by Brad Fitzpatrick
parent 513780f4f8
commit 1b56acf513

@ -1728,11 +1728,11 @@ func (b *LocalBackend) popBrowserAuthNow() {
// validPopBrowserURL reports whether urlStr is a valid value for a // validPopBrowserURL reports whether urlStr is a valid value for a
// control server to send in a *URL field. // control server to send in a *URL field.
//
// b.mu must *not* be held. // b.mu must *not* be held.
func (b *LocalBackend) validPopBrowserURL(urlStr string) bool { func (b *LocalBackend) validPopBrowserURL(urlStr string) bool {
if urlStr == "" { if urlStr == "" {
// Common case. return false
return true
} }
u, err := url.Parse(urlStr) u, err := url.Parse(urlStr)
if err != nil { if err != nil {
@ -1753,7 +1753,7 @@ func (b *LocalBackend) validPopBrowserURL(urlStr string) bool {
} }
func (b *LocalBackend) tellClientToBrowseToURL(url string) { func (b *LocalBackend) tellClientToBrowseToURL(url string) {
if url != "" && b.validPopBrowserURL(url) { if b.validPopBrowserURL(url) {
b.send(ipn.Notify{BrowseToURL: &url}) b.send(ipn.Notify{BrowseToURL: &url})
} }
} }

Loading…
Cancel
Save