From 74802300c42808126b9b324a80445f7e6f13ba2d Mon Sep 17 00:00:00 2001 From: Matthew Bednarski Date: Sun, 15 Sep 2024 19:43:16 +0200 Subject: [PATCH] Update bitbucketServerPullRequest.ts - protocol from apiBaseUrl use the protocol from apiBaseUrl instead of hard-coded "https" Signed-off-by: Matthew Bednarski --- .../src/actions/bitbucketServerPullRequest.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts b/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts index 440e402764..2ff06aa45d 100644 --- a/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts +++ b/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts @@ -237,6 +237,10 @@ const getDefaultBranch = async (opts: { } return defaultBranch; }; +const parseProtocol = (apiBaseUrl: string) => { + const url = new Url(apiBaseUrl); + return url.protocol || 'https'; +}; /** * Creates a BitbucketServer Pull Request action. * @public @@ -401,7 +405,8 @@ export function createPublishBitbucketServerPullRequestAction(options: { startPoint: latestCommit, }); - const remoteUrl = `https://${host}/scm/${project}/${repo}.git`; + const protocol = parseProtocol(apiBaseUrl); + const remoteUrl = `${protocol}://${host}/scm/${project}/${repo}.git`; const auth = authConfig.token ? {