Skip to content

Commit c17d33b

Browse files
James BoisvertJames Boisvert
authored andcommitted
update to conditional
1 parent 7102fe0 commit c17d33b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

backend/controllers/github.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,12 +2456,18 @@ jobs:
24562456
func (d DiggerController) GithubAppCallbackPage(c *gin.Context) {
24572457
installationId := c.Request.URL.Query()["installation_id"][0]
24582458
//setupAction := c.Request.URL.Query()["setup_action"][0]
2459-
code := c.Request.URL.Query()["code"][0]
2460-
if len(code) < 1 {
2459+
codeParams, codeExists := c.Request.URL.Query()["code"]
2460+
if !codeExists || len(codeParams) == 0 {
24612461
slog.Error("There was no code in the url query parameters")
24622462
c.String(http.StatusBadRequest, "could not find the code query parameter for github app")
24632463
return
24642464
}
2465+
code := codeParams[0]
2466+
if len(code) < 1 {
2467+
slog.Error("Code parameter is empty")
2468+
c.String(http.StatusBadRequest, "code parameter for github app is empty")
2469+
return
2470+
}
24652471
appId := c.Request.URL.Query().Get("state")
24662472

24672473
slog.Info("Processing GitHub app callback", "installationId", installationId, "appId", appId)

0 commit comments

Comments
 (0)