Skip to content

Commit 05ea699

Browse files
authored
Merge pull request #1647 from qodo-ai/es/bugfix_github_app_git_url_generation
Bugfix: Incorrect git url in case of GitHub app
2 parents e20e7c1 + 605eef6 commit 05ea699

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pr_agent/git_providers/github_provider.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ def _get_owner_and_repo_path(self, given_url: str) -> str:
8282
return ""
8383

8484
def get_git_repo_url(self, issues_or_pr_url: str) -> str:
85-
repo_path = self._get_owner_and_repo_path(issues_or_pr_url)
85+
repo_path = self._get_owner_and_repo_path(issues_or_pr_url) #Return: <OWNER>/<REPO>
8686
if not repo_path or repo_path not in issues_or_pr_url:
8787
get_logger().error(f"Unable to retrieve owner/path from url: {issues_or_pr_url}")
8888
return ""
89-
return f"{issues_or_pr_url.split(repo_path)[0]}{repo_path}.git"
89+
return f"{self.base_url_html}/{repo_path}.git" #https://github.com / <OWNER>/<REPO>.git
9090

9191
# Given a git repo url, return prefix and suffix of the provider in order to view a given file belonging to that repo.
9292
# Example: https://github.com/qodo-ai/pr-agent.git and branch: v0.8 -> prefix: "https://github.com/qodo-ai/pr-agent/blob/v0.8", suffix: ""
@@ -109,7 +109,7 @@ def get_canonical_url_parts(self, repo_git_url:str, desired_branch:str) -> Tuple
109109
owner, repo = self.repo.split('/')
110110
scheme_and_netloc = self.base_url_html
111111
desired_branch = self.get_pr_branch()
112-
if not any([scheme_and_netloc, owner, repo]): #"else": Not invoked from a PR context,but no provided git url for context
112+
if not all([scheme_and_netloc, owner, repo]): #"else": Not invoked from a PR context,but no provided git url for context
113113
get_logger().error(f"Unable to get canonical url parts since missing context (PR or explicit git url)")
114114
return ("", "")
115115

0 commit comments

Comments
 (0)