From 5c51ffd35587ea409978d2031a91708b23680ece Mon Sep 17 00:00:00 2001 From: davidvader Date: Fri, 7 Jun 2024 15:53:10 -0500 Subject: [PATCH 1/2] fix: only convert commands query param when provided --- api/build/id_request_token.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/api/build/id_request_token.go b/api/build/id_request_token.go index 1af34ce59..e1fb8bc69 100644 --- a/api/build/id_request_token.go +++ b/api/build/id_request_token.go @@ -113,13 +113,18 @@ func GetIDRequestToken(c *gin.Context) { return } - commands, err := strconv.ParseBool(c.Query("commands")) - if err != nil { - retErr := fmt.Errorf("unable to parse 'commands' query parameter as boolean %s: %w", c.Query("commands"), err) + commands := false + var err error - util.HandleError(c, http.StatusBadRequest, retErr) + if len(c.Query("commands")) > 0 { + commands, err = strconv.ParseBool(c.Query("commands")) + if err != nil { + retErr := fmt.Errorf("unable to parse 'commands' query parameter as boolean %s: %w", c.Query("commands"), err) - return + util.HandleError(c, http.StatusBadRequest, retErr) + + return + } } // retrieve token manager from context From a50c531bd9ca591caaac16f2ba7d91fe8bdd4d2a Mon Sep 17 00:00:00 2001 From: davidvader Date: Fri, 7 Jun 2024 16:03:00 -0500 Subject: [PATCH 2/2] fix: lint --- api/build/id_request_token.go | 1 + 1 file changed, 1 insertion(+) diff --git a/api/build/id_request_token.go b/api/build/id_request_token.go index e1fb8bc69..22e4d117c 100644 --- a/api/build/id_request_token.go +++ b/api/build/id_request_token.go @@ -114,6 +114,7 @@ func GetIDRequestToken(c *gin.Context) { } commands := false + var err error if len(c.Query("commands")) > 0 {