From 9555ca51894504eeedaf35749551f09f7c566bc8 Mon Sep 17 00:00:00 2001 From: MonikaNoeva Date: Tue, 29 Oct 2024 17:36:10 +0200 Subject: [PATCH 1/2] Changed deploy from url error message --- commands/deploy_command.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/commands/deploy_command.go b/commands/deploy_command.go index f23e8fd..4f8badc 100644 --- a/commands/deploy_command.go +++ b/commands/deploy_command.go @@ -437,7 +437,27 @@ func (c *DeployCommand) doUploadFromUrl(encodedFileUrl string, mtaClient mtaclie } file = jobResult.File if len(jobResult.Error) != 0 { - ui.Failed("Async upload job failed: %s", jobResult.Error) + var fileUrlWithoutCredentials string + + decodedBytes, err := base64.URLEncoding.DecodeString(encodedFileUrl) + if err != nil { + fmt.Println("Error decoding:", err) + fileUrlWithoutCredentials = "an unknown url" + } else { + decodedURL := string(decodedBytes) + + parsedURL, err := url.Parse(decodedURL) + if err != nil { + fmt.Println("Error parsing URL:", err) + fileUrlWithoutCredentials = "an unknown url" + } else { + parsedURL.User = nil + fileUrlWithoutCredentials = parsedURL.String() + } + } + + ui.Failed("Async upload job failed: Credentials to %s are wrong. Make sure that they are correct.", fileUrlWithoutCredentials) + return UploadFromUrlStatus{ FileId: "", MtaId: "", From a1b00e21e4f0b391d7aa72dad56e2736e427dfa1 Mon Sep 17 00:00:00 2001 From: MonikaNoeva Date: Mon, 4 Nov 2024 09:51:51 +0200 Subject: [PATCH 2/2] Fixed comments --- commands/deploy_command.go | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/commands/deploy_command.go b/commands/deploy_command.go index 4f8badc..4b5d793 100644 --- a/commands/deploy_command.go +++ b/commands/deploy_command.go @@ -436,27 +436,8 @@ func (c *DeployCommand) doUploadFromUrl(encodedFileUrl string, mtaClient mtaclie } } file = jobResult.File - if len(jobResult.Error) != 0 { - var fileUrlWithoutCredentials string - - decodedBytes, err := base64.URLEncoding.DecodeString(encodedFileUrl) - if err != nil { - fmt.Println("Error decoding:", err) - fileUrlWithoutCredentials = "an unknown url" - } else { - decodedURL := string(decodedBytes) - - parsedURL, err := url.Parse(decodedURL) - if err != nil { - fmt.Println("Error parsing URL:", err) - fileUrlWithoutCredentials = "an unknown url" - } else { - parsedURL.User = nil - fileUrlWithoutCredentials = parsedURL.String() - } - } - - ui.Failed("Async upload job failed: Credentials to %s are wrong. Make sure that they are correct.", fileUrlWithoutCredentials) + if len(jobResult.Error) != 0 { + ui.Failed("Async upload job failed: %s", jobResult.Error) return UploadFromUrlStatus{ FileId: "",