Skip to content
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

fix(llm_tools): fix permission checking to use relative path #1473

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

yuchanns
Copy link
Collaborator

@yuchanns yuchanns commented Mar 3, 2025

In projects such as Go, the output binary artifacts are automatically named after the project; for instance, the binary of a project called "go-project" is also referred to as "go-project." Users generally add the project name to .gitignore to prevent these artifacts from being submitted.

Currently, the method used to check .gitignore relies on absolute paths and fuzzy matching, which can result in files being incorrectly identified as ignored:

print(("/root/go-project/aaa/bbb/ccc.go"):match("go%-project")) -- print "go-project"

IMO the checker should only take care of the path inside the project root

@yuchanns yuchanns requested a review from yetone March 3, 2025 09:38
The has_permission_to_access function was incorrectly using absolute paths when checking against gitignore patterns. This could cause issues when the binary name matches the project root directory name, particularly in Go projects.

Changes:

- Extract relative path from absolute path by removing project root prefix

- Use relative path for gitignore pattern matching

- Add comments explaining the path handling logic

Signed-off-by: Hanchin Hsieh <me@yuchanns.xyz>
@yetone yetone merged commit c6d5527 into main Mar 3, 2025
4 checks passed
@yuchanns yuchanns deleted the fix-gitignore branch March 3, 2025 10:03
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