Skip to content

Commit fb7b7cf

Browse files
authored
Merge pull request #4136 from Dokploy/4066-git-clone-uses-external-url-instead-of-internal-url-when-oauth2-provider-has-internal-url-configured-causing-authelia-redirect-error
fix(git-provider): use internal URLs for Gitea and GitLab repository …
2 parents 5e999f1 + 9e52b72 commit fb7b7cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/server/src/utils/providers/gitlab.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ const getGitlabRepoClone = (
9090
gitlab: GitlabInfo,
9191
gitlabPathNamespace: string | null,
9292
) => {
93-
const repoClone = `${gitlab?.gitlabUrl.replace(/^https?:\/\//, "")}/${gitlabPathNamespace}.git`;
93+
const url = gitlab?.gitlabInternalUrl || gitlab?.gitlabUrl;
94+
const repoClone = `${url?.replace(/^https?:\/\//, "")}/${gitlabPathNamespace}.git`;
9495
return repoClone;
9596
};
9697

9798
const getGitlabCloneUrl = (gitlab: GitlabInfo, repoClone: string) => {
98-
const isSecure = gitlab?.gitlabUrl.startsWith("https://");
99+
const url = gitlab?.gitlabInternalUrl || gitlab?.gitlabUrl;
100+
const isSecure = url?.startsWith("https://");
99101
const cloneUrl = `http${isSecure ? "s" : ""}://oauth2:${gitlab?.accessToken}@${repoClone}`;
100102
return cloneUrl;
101103
};

0 commit comments

Comments
 (0)