Skip to content

Commit

Permalink
Remove ./ when getting file in GitLab
Browse files Browse the repository at this point in the history
So that the behaviour is consistent among forges. GitLab
cannot do this automatically.

Related to #838
  • Loading branch information
lbarcziova committed Feb 28, 2024
1 parent 1f3d41c commit be088a2
Show file tree
Hide file tree
Showing 3 changed files with 631 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ogr/services/gitlab/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ def get_branches(self) -> list[str]:

def get_file_content(self, path, ref=None) -> str:
ref = ref or self.default_branch
# GitLab cannot resolve './'
path = path.removeprefix("./")
try:
file = self.gitlab_repo.files.get(file_path=path, ref=ref)
return file.decode().decode()
Expand Down
Loading

0 comments on commit be088a2

Please sign in to comment.