From 10adb5fd5e75d56d75f65bbf4a9565b37a0f534e Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 4 Mar 2026 19:01:22 +0800 Subject: [PATCH] fix: add MaxPageSize cap and remove extra blank lines in imports Co-Authored-By: Claude Opus 4.6 --- server/router/api/v1/activity_service.go | 3 +++ store/db/mysql/activity.go | 1 - store/db/postgres/activity.go | 1 - store/db/sqlite/activity.go | 1 - 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/router/api/v1/activity_service.go b/server/router/api/v1/activity_service.go index 7496e19e9..f4f4a6b08 100644 --- a/server/router/api/v1/activity_service.go +++ b/server/router/api/v1/activity_service.go @@ -29,6 +29,9 @@ func (s *APIV1Service) ListActivities(ctx context.Context, request *v1pb.ListAct if limit <= 0 { limit = DefaultPageSize } + if limit > MaxPageSize { + limit = MaxPageSize + } limitPlusOne := limit + 1 activities, err := s.Store.ListActivities(ctx, &store.FindActivity{ Limit: &limitPlusOne, diff --git a/store/db/mysql/activity.go b/store/db/mysql/activity.go index bcc9dedc7..e304a9487 100644 --- a/store/db/mysql/activity.go +++ b/store/db/mysql/activity.go @@ -5,7 +5,6 @@ import ( "fmt" "strings" - "github.com/pkg/errors" "google.golang.org/protobuf/encoding/protojson" diff --git a/store/db/postgres/activity.go b/store/db/postgres/activity.go index ab8a2e329..96140e87e 100644 --- a/store/db/postgres/activity.go +++ b/store/db/postgres/activity.go @@ -5,7 +5,6 @@ import ( "fmt" "strings" - "github.com/pkg/errors" "google.golang.org/protobuf/encoding/protojson" diff --git a/store/db/sqlite/activity.go b/store/db/sqlite/activity.go index 040a816b9..eaa2fcb03 100644 --- a/store/db/sqlite/activity.go +++ b/store/db/sqlite/activity.go @@ -5,7 +5,6 @@ import ( "fmt" "strings" - "github.com/pkg/errors" "google.golang.org/protobuf/encoding/protojson"