From 662f83fcb916f52d448abaadc9582ce5b91151c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 14 Sep 2020 15:31:31 +0200 Subject: [PATCH] Fix `release download` Only ever try to set an `Authorization` request header to hosts that we have OAuth credentials for; skip the header otherwise. --- pkg/cmd/factory/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/factory/http.go b/pkg/cmd/factory/http.go index 0adc87a12..47fbbefe8 100644 --- a/pkg/cmd/factory/http.go +++ b/pkg/cmd/factory/http.go @@ -24,7 +24,7 @@ func NewHTTPClient(io *iostreams.IOStreams, cfg config.Config, appVersion string api.AddHeader("User-Agent", fmt.Sprintf("GitHub CLI %s", appVersion)), api.AddHeaderFunc("Authorization", func(req *http.Request) (string, error) { hostname := ghinstance.NormalizeHostname(req.URL.Hostname()) - if token, err := cfg.Get(hostname, "oauth_token"); err == nil || token != "" { + if token, err := cfg.Get(hostname, "oauth_token"); err == nil && token != "" { return fmt.Sprintf("token %s", token), nil } return "", nil