From c79a6567097e7bf711ff5059174b2db935c5c4eb Mon Sep 17 00:00:00 2001 From: flywukong <2229306838@qq.com> Date: Thu, 19 Oct 2023 10:20:55 +0800 Subject: [PATCH] fix: use const to judge version --- client/api_client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/api_client.go b/client/api_client.go index 77df1b41..b7060b4a 100644 --- a/client/api_client.go +++ b/client/api_client.go @@ -550,9 +550,10 @@ func (c *Client) generateURL(bucketName string, objectName string, relativePath var urlStr string if adminInfo.isAdminApi { var prefix string - if adminInfo.adminVersion == 1 { + // check the version and generate the url by the version + if adminInfo.adminVersion == types.AdminV1Version { prefix = types.AdminURLPrefix + types.AdminURLV1Version - } else if adminInfo.adminVersion == 2 { + } else if adminInfo.adminVersion == types.AdminV2Version { prefix = types.AdminURLPrefix + types.AdminURLV2Version } else { return nil, fmt.Errorf("invalid admin version %d", adminInfo.adminVersion)