From 402b6224a6018470fc2f2305a108ab321bbae33c Mon Sep 17 00:00:00 2001 From: Yumi Izumi Date: Tue, 5 Aug 2025 03:54:19 +0900 Subject: [PATCH] feat: allow optional HTTP protocol for self-hosted GitLab instances (#9757) Co-authored-by: Rohit Malhotra --- openhands/integrations/gitlab/gitlab_service.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openhands/integrations/gitlab/gitlab_service.py b/openhands/integrations/gitlab/gitlab_service.py index 34916da404..a681f36279 100644 --- a/openhands/integrations/gitlab/gitlab_service.py +++ b/openhands/integrations/gitlab/gitlab_service.py @@ -56,8 +56,15 @@ class GitLabService(BaseGitService, GitService): self.token = token if base_domain: - self.BASE_URL = f'https://{base_domain}/api/v4' - self.GRAPHQL_URL = f'https://{base_domain}/api/graphql' + # Check if protocol is already included + if base_domain.startswith(('http://', 'https://')): + # Use the provided protocol + self.BASE_URL = f'{base_domain}/api/v4' + self.GRAPHQL_URL = f'{base_domain}/api/graphql' + else: + # Default to https if no protocol specified + self.BASE_URL = f'https://{base_domain}/api/v4' + self.GRAPHQL_URL = f'https://{base_domain}/api/graphql' @property def provider(self) -> str: