From 5c51ffd35587ea409978d2031a91708b23680ece Mon Sep 17 00:00:00 2001 From: davidvader Date: Fri, 7 Jun 2024 15:53:10 -0500 Subject: [PATCH] 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