Skip to content

fix: fix repo relative path. directly use Repo.save_path. - #575

Merged
sng-asyncfunc merged 1 commit into
AsyncFuncAI:mainfrom
GdoongMathew:fix/codemap_filelink
Aug 12, 2026
Merged

fix: fix repo relative path. directly use Repo.save_path.#575
sng-asyncfunc merged 1 commit into
AsyncFuncAI:mainfrom
GdoongMathew:fix/codemap_filelink

Conversation

@GdoongMathew

Copy link
Copy Markdown
Collaborator

Summary

Fix invalid code map snippet, mainly caused by typo. Now we redirect all attribute from Repo class instead for consistency.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown

Greptile Summary

The PR replaces codemap’s duplicated repository-path resolver with Repo.save_path so file reads use the repository abstraction’s naming convention.

  • Imports and constructs Repo in read_repo_file.
  • Removes the local local_repo_dir helper.
  • Retains real-path normalization, traversal protection, and file-existence checks.

Confidence Score: 4/5

The URL normalization regression should be fixed before merging because whitespace-padded repository URLs now resolve as local paths and fail file reads.

The new resolver forwards an untrimmed free-form URL into Repo; URL detection then fails and save_path points at the raw value rather than the existing clone directory.

Files Needing Attention: api/services/codemap.py

Important Files Changed

Filename Overview
api/services/codemap.py Repository path resolution is consolidated through Repo.save_path, but the change drops the prior whitespace normalization for repository URLs.

Reviews (1): Last reviewed commit: "fix: fix repo relative path. directly us..." | Re-trigger Greptile

Comment thread api/services/codemap.py
def read_repo_file(repo_url: str, repo_type: str | None, file_path: str) -> str:
"""Read a file from the cloned/local repository, guarding against traversal."""
repo_dir = os.path.realpath(local_repo_dir(repo_url, repo_type))
repo_dir = os.path.realpath(Repo(repo_url=repo_url, repo_type=repo_type).save_path)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Untrimmed URLs resolve as local paths

When repo_url contains leading or trailing whitespace, Repo receives the untrimmed value and fails to recognize it as a URL, causing the file lookup to use the wrong directory and raise FileNotFoundError.

Suggested change
repo_dir = os.path.realpath(Repo(repo_url=repo_url, repo_type=repo_type).save_path)
repo_dir = os.path.realpath(
Repo(repo_url=repo_url.strip(), repo_type=repo_type).save_path
)

@sng-asyncfunc
sng-asyncfunc merged commit ee8e885 into AsyncFuncAI:main Aug 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants