Skip to content

fix(ssh): treat symlinked directories as folders#1717

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/ssh-symlink-2
May 12, 2026
Merged

fix(ssh): treat symlinked directories as folders#1717
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/ssh-symlink-2

Conversation

@Jinwoo-H
Copy link
Copy Markdown
Contributor

@Jinwoo-H Jinwoo-H commented May 12, 2026

Summary

Follow-up to #1661 and #1672.

PR #1672 removed the SSH relay path allowlist so symlink targets outside the workspace can be opened, but directory symlinks were still misclassified by directory listings:

  • fs.readDir used Dirent.isDirectory(), which returns false for symlink entries.
  • The file explorer therefore treated a symlink-to-directory like a file.
  • Clicking it called readFile, which failed with EISDIR: illegal operation on a directory, read.

This PR makes directory listings report symlink-to-directory entries as directories while preserving isSymlink: true.

What changed

  • Relay fs.readDir follows symlink entries with stat() only to determine whether the target is a directory.
  • Relay fs.stat returns the target file/directory type for symlinks, falling back to symlink for broken links.
  • Local fs:readDir gets the same symlink-to-directory behavior, but still resolves through the existing authorized-path boundary.
  • Added regression coverage for directory symlinks in both relay and local filesystem tests.

Verification

  • pnpm test src/relay/fs-handler.test.ts src/main/ipc/filesystem.test.ts
  • pnpm tc:node
  • Manual SSH repro on openclaw 2 using /home/jinwoo/Documents/repo-test/Model -> /tmp/orca-repo-test-symlink-target

Note: local commands emitted the existing Node engine warning because this machine is on Node v25.9.0 while the repo wants Node 24, but both commands passed.

Made with Orca 🐋

Co-authored-by: Orca <help@stably.ai>
@Jinwoo-H Jinwoo-H merged commit a54436a into main May 12, 2026
3 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.

1 participant