Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(vcs): compare results length with const instead of literals (#2154)

Joe Chen7cddfd424d7a
diff --git a/plugin/vcs/github/github.go b/plugin/vcs/github/github.go
index f2397f09df..9ab2813046 100644
--- a/plugin/vcs/github/github.go
+++ b/plugin/vcs/github/github.go
@@ -420,7 +420,7 @@ func (p *Provider) fetchPaginatedRepositoryCollaborators(ctx context.Context, oa
// page to avoid introducing a new dependency, see
// https://github.com/bytebase/bytebase/pull/1423#discussion_r884278534 for the
// discussion.
- return collaborators, len(collaborators) >= 100, nil
+ return collaborators, len(collaborators) >= apiPageSize, nil
}
// oauthResponse is a GitHub OAuth response.
@@ -559,7 +559,7 @@ func (p *Provider) fetchPaginatedRepositoryList(ctx context.Context, oauthCtx co
// page to avoid introducing a new dependency, see
// https://github.com/bytebase/bytebase/pull/1423#discussion_r884278534 for the
// discussion.
- return repos, len(repos) >= 100, nil
+ return repos, len(repos) >= apiPageSize, nil
}
// FetchRepositoryFileList fetches the all files from the given repository tree
diff --git a/plugin/vcs/gitlab/gitlab.go b/plugin/vcs/gitlab/gitlab.go
index 82fd8304b4..63087142fc 100644
--- a/plugin/vcs/gitlab/gitlab.go
+++ b/plugin/vcs/gitlab/gitlab.go
@@ -333,7 +333,7 @@ func (p *Provider) fetchPaginatedRepositoryList(ctx context.Context, oauthCtx co
// page to avoid introducing a new dependency, see
// https://github.com/bytebase/bytebase/pull/1423#discussion_r884278534 for the
// discussion.
- return repos, len(repos) >= 100, nil
+ return repos, len(repos) >= apiPageSize, nil
}
// fetchUserInfo fetches user information from the given resourceURI, which
@@ -562,7 +562,7 @@ func (p *Provider) fetchPaginatedRepositoryActiveMemberList(ctx context.Context,
// page to avoid introducing a new dependency, see
// https://github.com/bytebase/bytebase/pull/1423#discussion_r884278534 for the
// discussion.
- return members, len(members) >= 100, nil
+ return members, len(members) >= apiPageSize, nil
}
// FetchRepositoryFileList fetches the all files from the given repository tree
@@ -642,7 +642,7 @@ func (p *Provider) fetchPaginatedRepositoryFileList(ctx context.Context, oauthCt
// page to avoid introducing a new dependency, see
// https://github.com/bytebase/bytebase/pull/1423#discussion_r884278534 for the
// discussion.
- return treeNodes, len(treeNodes) >= 100, nil
+ return treeNodes, len(treeNodes) >= apiPageSize, nil
}
// CreateFile creates a file at given path in the repository.