Skip to content

Commit 3cab7b1

Browse files
committed
conv rest to gql params for safe lint
1 parent d2dd8f2 commit 3cab7b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/github/server.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,14 @@ type UnifiedPaginationParams struct {
246246
// ToGraphQLParams converts REST API pagination parameters to GraphQL-specific parameters.
247247
// This converts page/perPage to first parameter for GraphQL queries.
248248
func (u UnifiedPaginationParams) ToGraphQLParams() GraphQLPaginationParams {
249+
// Cap perPage to safe range before converting to int32
249250
perPage := u.PerPage
250-
if perPage > 2147483647 {
251+
if perPage > 100 { // GraphQL expects a max of 100
251252
perPage = 100
252253
}
254+
if perPage < 1 {
255+
perPage = 1
256+
}
253257
first := int32(perPage)
254258

255259
return GraphQLPaginationParams{

0 commit comments

Comments
 (0)