Skip to content

Commit b0459c5

Browse files
committed
add comment to ListJobs with runID and check runID > 0
1 parent 7a4de43 commit b0459c5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

routers/api/v1/repo/action.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,14 @@ func ListWorkflowRunJobs(ctx *context.APIContext) {
11941194

11951195
runID := ctx.PathParamInt64("run")
11961196

1197+
// Avoid the list all jobs functionality for this api route to be used with a runID == 0.
1198+
if runID <= 0 {
1199+
ctx.APIError(http.StatusBadRequest, util.NewInvalidArgumentErrorf("runID must be a positive integer"))
1200+
return
1201+
}
1202+
1203+
// runID is used as an additional filter next to repoID to ensure that we only list jobs for the specified repoID and runID.
1204+
// no additional checks for runID are needed here
11971205
shared.ListJobs(ctx, 0, repoID, runID)
11981206
}
11991207

0 commit comments

Comments
 (0)