From f96114ad80b97b2fef9b9e3e8d3b1b0c6f38e5d0 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 9 Nov 2025 03:18:07 -0600 Subject: [PATCH] Refactor Bitbucket repository cloning logic: remove unused parameter and enhance error handling by retrieving Bitbucket provider directly within the function. --- packages/server/src/utils/providers/bitbucket.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/server/src/utils/providers/bitbucket.ts b/packages/server/src/utils/providers/bitbucket.ts index 8a62c5d22..217dba271 100644 --- a/packages/server/src/utils/providers/bitbucket.ts +++ b/packages/server/src/utils/providers/bitbucket.ts @@ -87,7 +87,6 @@ interface CloneBitbucketRepository { bitbucketOwner: string | null; bitbucketBranch: string | null; bitbucketId: string | null; - bitbucket: Bitbucket | null; enableSubmodules: boolean; serverId: string | null; type?: "application" | "compose"; @@ -104,7 +103,6 @@ export const cloneBitbucketRepository = async ({ bitbucketOwner, bitbucketBranch, bitbucketId, - bitbucket, enableSubmodules, serverId, } = entity; @@ -114,7 +112,12 @@ export const cloneBitbucketRepository = async ({ command += `echo "Error: ❌ Bitbucket Provider not found"; exit 1;`; return command; } + const bitbucket = await findBitbucketById(bitbucketId); + if (!bitbucket) { + command += `echo "Error: ❌ Bitbucket Provider not found"; exit 1;`; + return command; + } const basePath = type === "compose" ? COMPOSE_PATH : APPLICATIONS_PATH; const outputPath = join(basePath, appName, "code"); command += `rm -rf ${outputPath};`;