From ebcd4dbf3db44bd464fbdb8c873cffbaa5db8199 Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Tue, 5 Aug 2025 23:58:43 +0800 Subject: [PATCH] Fix activation URL extraction logic and improve warning message formatting - Corrected JSON path for error code and activation URL extraction in client error handling. - Improved readability of the activation warning message with better spacing. --- internal/client/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/client/client.go b/internal/client/client.go index 146e49b8..d25dd8de 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -844,11 +844,11 @@ func (c *Client) CheckCloudAPIIsEnabled() (bool, error) { if err.StatusCode == 403 { errJSON := err.Error.Error() // Check for a specific error code and extract the activation URL. - if gjson.Get(errJSON, "error.code").Int() == 403 { - activationURL := gjson.Get(errJSON, "error.details.0.metadata.activationUrl").String() + if gjson.Get(errJSON, "0.error.code").Int() == 403 { + activationURL := gjson.Get(errJSON, "0.error.details.0.metadata.activationUrl").String() if activationURL != "" { log.Warnf( - "\n\nPlease activate your account with this url:\n\n%s\n And execute this command again:\n%s --login --project_id %s", + "\n\nPlease activate your account with this url:\n\n%s\n\n And execute this command again:\n%s --login --project_id %s", activationURL, os.Args[0], c.tokenStorage.ProjectID,