[PR #11351] fix: handle symlink directories in file listing #13750

Open
opened 2026-02-16 18:18:35 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11351

State: open
Merged: No


What does this PR do?

When there are symbolic links pointing to directories in the file system, opencode's file listing function cannot correctly identify these symbolic links. The specific manifestations are:

  • Symbolic links pointing to directories are incorrectly identified as files
  • This leads to inaccuracies in file browsing and file listing

How did you verify your code works?

Node.js's fs.Dirent.isDirectory() method has special behavior when handling symbolic links:

  • For ordinary directories, isDirectory() returns true
  • For symbolic links pointing to directories, isDirectory() returns false (because the symbolic link itself is not a directory, but just a link pointing to a directory)

This behavior causes the code to fail to correctly distinguish between symbolic links and ordinary files. This fix ensures that symbolic links pointing to directories are correctly identified by tracking the symbolic link to its target.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11351 **State:** open **Merged:** No --- ### What does this PR do? When there are symbolic links pointing to directories in the file system, opencode's file listing function cannot correctly identify these symbolic links. The specific manifestations are: - Symbolic links pointing to directories are incorrectly identified as files - This leads to inaccuracies in file browsing and file listing ### How did you verify your code works? Node.js's `fs.Dirent.isDirectory()` method has special behavior when handling symbolic links: - For ordinary directories, `isDirectory()` returns `true` - For symbolic links pointing to directories, `isDirectory()` returns `false` (because the symbolic link itself is not a directory, but just a link pointing to a directory) This behavior causes the code to fail to correctly distinguish between symbolic links and ordinary files. This fix ensures that symbolic links pointing to directories are correctly identified by tracking the symbolic link to its target.
yindo added the pull-request label 2026-02-16 18:18:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13750