From d08606598172d3388b552d11efeeec653d189654 Mon Sep 17 00:00:00 2001 From: dave vader <48764154+plyr4@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:23:00 -0500 Subject: [PATCH] fix: only convert commands query param when provided (#1140) * fix: only convert commands query param when provided * fix: lint --- api/build/id_request_token.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/api/build/id_request_token.go b/api/build/id_request_token.go index 1af34ce59..22e4d117c 100644 --- a/api/build/id_request_token.go +++ b/api/build/id_request_token.go @@ -113,13 +113,19 @@ 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 - util.HandleError(c, http.StatusBadRequest, retErr) + var err error - return + 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) + + util.HandleError(c, http.StatusBadRequest, retErr) + + return + } } // retrieve token manager from context