@@ -2454,9 +2454,31 @@ jobs:
2454
2454
}
2455
2455
2456
2456
func (d DiggerController ) GithubAppCallbackPage (c * gin.Context ) {
2457
- installationId := c .Request .URL .Query ()["installation_id" ][0 ]
2457
+ installationIdParams , installationIdExists := c .Request .URL .Query ()["installation_id" ]
2458
+ if ! installationIdExists || len (installationIdParams ) == 0 {
2459
+ slog .Error ("There was no installation_id in the url query parameters" )
2460
+ c .String (http .StatusBadRequest , "could not find the installation_id query parameter for github app" )
2461
+ return
2462
+ }
2463
+ installationId := installationIdParams [0 ]
2464
+ if len (installationId ) < 1 {
2465
+ slog .Error ("Installation_id parameter is empty" )
2466
+ c .String (http .StatusBadRequest , "installation_id parameter for github app is empty" )
2467
+ return
2468
+ }
2458
2469
//setupAction := c.Request.URL.Query()["setup_action"][0]
2459
- code := c .Request .URL .Query ()["code" ][0 ]
2470
+ codeParams , codeExists := c .Request .URL .Query ()["code" ]
2471
+ if ! codeExists || len (codeParams ) == 0 {
2472
+ slog .Error ("There was no code in the url query parameters" )
2473
+ c .String (http .StatusBadRequest , "could not find the code query parameter for github app" )
2474
+ return
2475
+ }
2476
+ code := codeParams [0 ]
2477
+ if len (code ) < 1 {
2478
+ slog .Error ("Code parameter is empty" )
2479
+ c .String (http .StatusBadRequest , "code parameter for github app is empty" )
2480
+ return
2481
+ }
2460
2482
appId := c .Request .URL .Query ().Get ("state" )
2461
2483
2462
2484
slog .Info ("Processing GitHub app callback" , "installationId" , installationId , "appId" , appId )
0 commit comments