Skip to content

fix(core): treat symlink-to-directory as directory type#28531

Closed
vanhci wants to merge 1 commit into
anomalyco:devfrom
vanhci:fix/issue-28526-symlink-directory
Closed

fix(core): treat symlink-to-directory as directory type#28531
vanhci wants to merge 1 commit into
anomalyco:devfrom
vanhci:fix/issue-28526-symlink-directory

Conversation

@vanhci
Copy link
Copy Markdown

@vanhci vanhci commented May 20, 2026

Description

Symlinked directories (Linux ln -s) and Windows junction points (e.g., OneDrive Desktop) were classified as 'symlink' because Node's isDirectory() returns false for reparse points. The downstream filter in file/index.ts skips entries with type !== 'directory', causing symlinked directories to be invisible in the directory picker and @file picker.

Root Cause

packages/core/src/filesystem.ts:74readDirectoryEntries classifies symlinks and junction points as 'symlink' because e.isDirectory() returns false for reparse points. The check order was: isDirectory ? directory : isSymbolicLink ? symlink : isFile ? file : other.

Fix

Check isDirectory() for symlinks first to determine if the target is a directory:

// Before
type: e.isDirectory() ? "directory" : e.isSymbolicLink() ? "symlink" : e.isFile() ? "file" : "other"

// After  
type: e.isSymbolicLink() ? (e.isDirectory() ? "directory" : "symlink") : e.isDirectory() ? "directory" : e.isFile() ? "file" : "other"

Fixes #28526


This PR was auto-generated as part of the GitHub Bounty Hunting workflow.

Symlinked directories (Linux ln -s) and Windows junction points were
classified as 'symlink' because Node's isDirectory() returns false for
reparse points. The downstream filter in file/index.ts skips entries
with type !== 'directory', causing symlinked directories to be invisible
in the directory picker and @file picker.

Fix: check isDirectory() first for symlinks to determine if the target
is a directory, returning 'directory' type instead of 'symlink'.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found

PR #28529: fix(filesystem): resolve symlink/junction targets to directory type
#28529

This PR appears to be addressing the exact same issue as PR #28531. Both PRs:

  • Fix symlink/junction point directory classification in the filesystem module
  • Target the same root cause: isDirectory() returning false for reparse points
  • Aim to make symlinked directories visible in file/directory pickers

Recommendation: Check if PR #28529 is already merged or if one should be closed in favor of the other.

@danielxxomg
Copy link
Copy Markdown

Hey, thanks for taking a stab at this! Quick note — e.isDirectory() returns false for Windows junction points (reparse points like OneDrive Desktop). Your ternary won't resolve those because isDirectory() doesn't follow the link on Windows.

The fix in #28532 uses NFS.stat(join(dirPath, e.name)) to actually follow the link and check the target type, which works on Linux symlinks, Windows junctions, and macOS aliases.

Want to close this in favor of #28532? It covers all platforms.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 20, 2026
@github-actions github-actions Bot closed this May 20, 2026
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.

fix: symlink/junction directories invisible in directory picker and @file

2 participants