Skip to content

Commit 326cdb5

Browse files
committed
fix(backend): adjust repository empty check to only verify default branch
1 parent b32f79a commit 326cdb5

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

services/backend/src/routes/teams/deploy/github.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,9 @@ export default async function deployGitHubRoutes(server: FastifyInstance) {
564564
// Get repository details for default branch
565565
const { data: repoData } = await octokit.repos.get({ owner, repo });
566566

567-
// Check if repository is empty
568-
if (repoData.size === 0 || !repoData.default_branch) {
567+
// Check if repository is empty (only check for default branch, not size)
568+
// Note: GitHub's size field is in KB and can be 0 for very small repos
569+
if (!repoData.default_branch) {
569570
const errorResponse: ErrorResponse = {
570571
success: false,
571572
error: `Repository ${owner}/${repo} is empty. Please push code to the repository before deploying.`

services/frontend/src/services/deploymentService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class DeploymentService {
108108
repo: string
109109
): Promise<BranchesResponse> {
110110
const response = await fetch(
111-
`${this.baseUrl}/api/teams/${teamId}/deploy/github/repositories/${owner}/${repo}/branches`,
111+
`${this.baseUrl}/api/teams/${teamId}/deploy/github/repositories/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/branches`,
112112
{
113113
method: 'GET',
114114
credentials: 'include'

0 commit comments

Comments
 (0)