Skip to content

Commit

Permalink
fix: only convert commands query param when provided (#1140)
Browse files Browse the repository at this point in the history
* fix: only convert commands query param when provided

* fix: lint
  • Loading branch information
plyr4 authored Jun 10, 2024
1 parent a083311 commit d086065
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions api/build/id_request_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d086065

Please sign in to comment.