nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] File tools reject an absolute path that is inside the project through a symlink

Open Dhirenderchoudhary opened this issue 1 month ago • 3 comments

Description

isValidFilePath checks absolute paths with isPathInside, which only compares the path strings. resolveFilePath calls that check before it looks at the real path, so the symlink check later in the function never runs.

Steps to Reproduce

  1. Open a project through a symlink. On macOS this also shows up for /tmp vs /private/tmp.
  2. Ask a file tool for the same file using the other spelling of the path.

Expected Behavior

The tool accepts the path. It is the same directory.

Actual Behavior

resolveFilePath throws Invalid file path. Both directions fail: symlink root with the real path, and real root with the symlink path.

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] I can reproduce this issue consistently

Dhirenderchoudhary avatar Oct 07 '26 22:10 Dhirenderchoudhary

@akramcodez Can i go for it ?

Dhirenderchoudhary avatar Oct 08 '26 08:10 Dhirenderchoudhary

@addyCooks can i take this too? the string-compare-before-realpath ordering in isValidFilePath looks straightforward to fix, and i can reproduce the symlink case on macos.

deepcfr avatar Oct 09 '26 17:10 deepcfr

@addyCooks thanks for the link. i saw someone already has a fix ready above so i'll step back. still keen on #1636/#1637 if either's free....

deepcfr avatar Oct 10 '26 06:10 deepcfr