mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
community: Fix branch not being considered when using GithubFileLoader (#20075)
- **Description:** Added `ref` query parameter so data is not loaded only from the default branch but any branch passed --------- Co-authored-by: Osama Mehdi <mehdi@hm.edu> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
parent
54d2b861f6
commit
c6f00e6bdc
@ -206,7 +206,10 @@ class GithubFileLoader(BaseGitHubLoader, ABC):
|
||||
]
|
||||
|
||||
def get_file_content_by_path(self, path: str) -> str:
|
||||
base_url = f"{self.github_api_url}/repos/{self.repo}/contents/{path}"
|
||||
queryparams = f"?ref={self.branch}" if self.branch else ""
|
||||
base_url = (
|
||||
f"{self.github_api_url}/repos/{self.repo}/contents/{path}{queryparams}"
|
||||
)
|
||||
response = requests.get(base_url, headers=self.headers)
|
||||
response.raise_for_status()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user