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>
This commit is contained in:
Brad Fitzpatrick 2022-11-16 09:19:59 -08:00 committed by Brad Fitzpatrick
parent 513780f4f8
commit 1b56acf513

View File

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