-
Notifications
You must be signed in to change notification settings - Fork 3
use lower cases for various file viewers #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,6 +126,9 @@ async def fetch_file_from_gh( | |
| """ | ||
| Fetch the content of a file from a GitHub repository. | ||
| """ | ||
| owner = owner.lower() | ||
| repo = repo.lower() | ||
|
|
||
| r = await call_api( | ||
| url=f"https://api.github.com/repos/{owner}/{repo}/contents/{path}", | ||
| params={} | ||
|
|
@@ -146,6 +149,9 @@ async def get_file_lines_from_gh( | |
| length: int = Field(description="The ending line number to fetch from the file", default=10)) -> str: | ||
| """Fetch a range of lines from a file in a GitHub repository. | ||
| """ | ||
| owner = owner.lower() | ||
| repo = repo.lower() | ||
|
Comment on lines
+152
to
+153
|
||
|
|
||
| r = await call_api( | ||
| url=f"https://api.github.com/repos/{owner}/{repo}/contents/{path}", | ||
| params={} | ||
|
|
@@ -171,6 +177,9 @@ async def search_file_from_gh( | |
| """ | ||
| Search for a term in a file from a GitHub repository. | ||
| """ | ||
| owner = owner.lower() | ||
| repo = repo.lower() | ||
|
Comment on lines
+180
to
+181
|
||
|
|
||
| r = await call_api( | ||
| url=f"https://api.github.com/repos/{owner}/{repo}/contents/{path}", | ||
| params={} | ||
|
|
@@ -193,6 +202,9 @@ async def search_files_from_gh( | |
| """ | ||
| Search for a term in a list of files from a GitHub repository. | ||
| """ | ||
| owner = owner.lower() | ||
| repo = repo.lower() | ||
|
Comment on lines
+205
to
+206
|
||
|
|
||
| paths_list = [path.strip() for path in paths.split(',')] | ||
| if not paths_list: | ||
| return "No paths provided for search." | ||
|
|
@@ -238,6 +250,9 @@ async def list_directory_from_gh( | |
| """ | ||
| Fetch the content of a directory from a GitHub repository. | ||
| """ | ||
| owner = owner.lower() | ||
| repo = repo.lower() | ||
|
Comment on lines
+253
to
+254
|
||
|
|
||
| r = await call_api( | ||
| url=f"https://api.github.com/repos/{owner}/{repo}/contents/{path}", | ||
| params={} | ||
|
|
@@ -259,6 +274,9 @@ async def search_repo_from_gh( | |
| """ | ||
| Search for the search term in the entire repository. | ||
| """ | ||
| owner = owner.lower() | ||
| repo = repo.lower() | ||
|
Comment on lines
+277
to
+278
|
||
|
|
||
| with tempfile.TemporaryDirectory() as tmp_dir: | ||
| result = await _fetch_source_zip(owner, repo, tmp_dir) | ||
| source_path = Path(f"{tmp_dir}/{owner}/{repo}.zip") | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -111,6 +111,9 @@ async def fetch_file_content( | |||||
| """ | ||||||
| Fetch the content of a file from a local GitHub repository. | ||||||
| """ | ||||||
| owner = owner.lower() | ||||||
| repo = repo.lower() | ||||||
|
Comment on lines
+114
to
+115
|
||||||
| owner = owner.lower() | |
| repo = repo.lower() |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting owner and repo names to lowercase will break file path lookups for repositories that were downloaded with their original case. The file system paths are constructed using the original case, so lowercasing these parameters will cause path mismatches and file-not-found errors.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,6 +95,9 @@ async def fetch_repo_from_gh( | |
| """ | ||
| Download the source code from GitHub to the local file system to speed up file search. | ||
| """ | ||
| owner = owner.lower() | ||
| repo = repo.lower() | ||
|
Comment on lines
+98
to
+99
|
||
|
|
||
| result = await _fetch_source_zip(owner, repo, LOCAL_GH_DIR) | ||
| source_path = Path(f"{LOCAL_GH_DIR}/{owner}/{repo}.zip") | ||
| if not source_path.exists(): | ||
|
|
@@ -106,6 +109,9 @@ async def clear_local_repo(owner: str, repo: str): | |
| """ | ||
| Delete the local repo. | ||
| """ | ||
| owner = owner.lower() | ||
| repo = repo.lower() | ||
|
Comment on lines
+112
to
+113
|
||
|
|
||
| source_path = Path(f"{LOCAL_GH_DIR}/{owner}/{repo}.zip") | ||
| source_path = sanitize_file_path(source_path, [LOCAL_GH_DIR]) | ||
| if not source_path: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting owner and repo names to lowercase will cause API failures for repositories with uppercase characters in their names. GitHub's API is case-sensitive and requires the exact case of the repository owner and name. For example, calling the API with "github/copilot" when the actual repository is "GitHub/Copilot" will result in a 404 error.