From 2054b2d8e8741f77ded0b00d30e7e424d775aeb4 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 8 Aug 2024 16:25:41 +0400 Subject: [PATCH] fix auth URL hanlding for ipv6 --- cmd/lib/api.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/lib/api.go b/cmd/lib/api.go index abdf74b1a..62b0000ce 100644 --- a/cmd/lib/api.go +++ b/cmd/lib/api.go @@ -2,7 +2,6 @@ package lib import ( "context" - "errors" "fmt" "net/http" "strings" @@ -90,10 +89,7 @@ func GetMinerApi(ctx context.Context, ai string, log *logging.ZapEventLogger) (v } func StorageAuthWithURL(apiInfo string) (sealer.StorageAuth, error) { - s := strings.Split(apiInfo, ":") - if len(s) != 2 { - return nil, errors.New("unexpected format of `apiInfo`") - } + s := strings.SplitN(apiInfo, ":", 2) headers := http.Header{} headers.Add("Authorization", "Bearer "+s[0]) return sealer.StorageAuth(headers), nil