Repository navigation
Description
Goal
In the file browser, a symbolic link that points to a folder behaves like a folder: it is shown and sorted with the folders, and clicking it opens the folder it points to. All symbolic links are visibly marked as links, with the link target shown on hover.
Context
- The listing reports each link itself, not its target (SFTP READDIR attributes are lstat-like):
crates/ssh-transport/src/sftp.rs:198-229(remote_entry,list_dir) andcrates/ssh-transport/src/local_sftp.rs:130-175(local pseudo-server, same lstat semantics). So a link to a folder arrives withis_dir == false, is_symlink == true. Nothing resolves the target. RemoteEntry(crates/core/src/ssh/types.rs:122-137) carriesis_symlink, butRemoteEntryDto(crates/app-logic/src/file_browser.rs:11-48) drops it inFrom<&RemoteEntry>. The frontend type isRemoteEntryDtoinapps/smart-ssh-community/frontend/src/generated/ipc.ts:225(generated bynpm run gen:ipcfrom ts-rs).sftp_list→list_impl(crates/app-shell/src/commands/sftp/list.rs:3-70) maps entries and sorts them withsort_remote_entries(file_browser.rs:64-72, folders first). The elevated channel uses the samelist_impl.- Frontend:
components/fileBrowser/FileTable.tsx:150-163andcomponents/fileBrowser/NarrowEntryList.tsx:51-63render a clickable 📁 button (load(entry.path)) only whenentry.isDir; everything else is a non-interactive 📄<span>.lib/fileSort.ts:46-54keeps folders on top viaisDir.FilePropertiesDialog.tsx:45shows the type.FileEntryMenu.tsx:84-87shows file actions for non-folders. - Today a link to a folder (e.g.
/var/www/current -> /srv/releases/42) is shown as a file, sorts among the files, cannot be opened, and its menu offers file actions. - Navigation (
components/fileBrowser/useRemoteDirectory.ts:33-54) keeps the path it was given; "Up" uses the string-basedparentPath(lib/remotePath.ts:11-17). SftpSession(crates/core/src/ssh/transport.rs) hasstat(:330, follows links) andlstat(:338) but noread_link. russh-sftp offersRawSftpSession/SftpSession::read_link.- Spec 0020 §7 (
docs/specs/0020-sftp-file-transfer.md:255-257) says links are listed like normal entries; no spec defines navigating into them.
Requirements
Decided by maintainer:
- Logical path. Clicking a link to a folder navigates to the link path itself (e.g.
/var/www/current), not to the resolved target. The path field shows the link path; "Up" goes to the logical parent (/var/www), likecdin a shell. No realpath call. - Display.
- Link to a folder: folder icon with a visible link marker, sorted among the folders (frontend
fileSort.tsand backendsort_remote_entries), clickable exactly like a folder (wide table and narrow list). - Link to a file: file icon with the link marker, sorted among the files, not navigable (as files today).
- Broken link (target missing or not accessible): link marker, visually de-emphasised, not navigable.
- Hover/tooltip on every link shows its target (
-> <target>as returned by readlink). If the target cannot be read, the tooltip omits it. - The marker has an accessible label (e.g. "symbolic link"), not only a glyph.
- Link to a folder: folder icon with a visible link marker, sorted among the folders (frontend
- The listing resolves the target type of each link with one
statper link entry; a failingstat(dangling link, permission denied) marks the entry as broken and never fails the listing. - Recursive and destructive operations keep their current lstat semantics: delete, chmod/chown recursion and the folder-download tree walk still treat links as non-folders and never descend into them. Deleting a link to a folder removes only the link (existing behaviour, keep its test green).
- The context menu of a link to a folder offers the folder actions (as for a folder), not the file actions. Properties shows the type as a link (to folder / to file / broken) and the target.
- Works on the normal SFTP channel, the elevated channel and the local pseudo-server.
Acceptance Criteria
-
RemoteEntryDtogainsisSymlink: boolean,linkTarget: string | nulland a way to tell the link's target type (e.g.targetIsDir: boolean | null,null= broken);generated/ipc.tsis regenerated - In a folder containing
link-dir -> <folder>,link-file -> <file>and a dangling link, the listing returns:link-dirwithisDir == true(navigable) andisSymlink == true;link-filewithisDir == false,isSymlink == true; the dangling link withisSymlink == true, marked broken; the listing does not fail - Clicking
link-dir(wide table and narrow list) loads<current>/link-dir; the path field shows that path; "Up" returns to<current> -
link-dirsorts among the folders and shows the folder icon plus the link marker;link-filesorts among the files with the file icon plus the marker; the broken link is de-emphasised and not clickable - Hovering a link shows its target; the marker has an accessible label in all locales (key parity test passes)
- The context menu of
link-dirshows folder actions; Properties shows link type and target - Recursive delete, chmod/chown and folder download do not descend into
link-dir(existing tests stay green; add one for the folder-download walk if none covers it) - Listing a folder with N links issues at most one extra
stat(and oneread_link) per link entry, none for ordinary entries (unit test with a counting fake) - Works through the elevated channel and the local pseudo-server (unit tests with the respective fakes;
crates/ssh-transport/tests/sshd_exec_sftp.rslisting_with_symlinks_unicode_and_spacesextended for the new fields) - Frontend tests (vitest) for rendering, sorting and navigation of the three link kinds
- Spec 0020 §7 updated: links are listed with their marker, links to folders are navigable by logical path, recursive operations never follow links
- Relevant automated tests pass
Technical Notes
- Add
read_linkto theSftpSessiontrait with a default implementation returning an unsupported error, so the many test fakes need no change; implement it for the russh-sftp session, the local pseudo-server (tokio::fs::read_link) and the elevated channel implementation (crates/app-shell/src/commands/elevation/sftp_impl.rs). Unsupported →linkTarget = null. - Resolve in
list_impl(or a helper in app-logic) only for entries withis_symlink; keepRemoteEntry.is_dirfrom READDIR unchanged in core so tree walks incrates/app-logic/src/sftp_ops.rskeep their lstat semantics. The DTO'sisDirmay reflect the resolved type for navigation, but no recursive operation may use the DTO to decide whether to descend. - Take the SFTP lock per call as the existing code does; do not hold it across the whole listing longer than today.
- Link targets are server-controlled strings: render as text only (no HTML), truncate long values in the tooltip.
- Downloading a link to a folder from the menu already follows the link at the root (
download.rs:358-361,stat); leave that as is. - Security-relevant area: recursive delete/chmod/chown must never follow a link (ADR 0045, Spec 0054). Add a regression test that a recursive delete of a folder containing a link to a folder leaves the link target untouched, if not already covered.
Files: crates/core/src/ssh/transport.rs, crates/core/src/ssh/types.rs, crates/ssh-transport/src/sftp.rs, crates/ssh-transport/src/local_sftp.rs, crates/ssh-transport/tests/, crates/app-shell/src/commands/elevation/sftp_impl.rs, crates/app-shell/src/commands/sftp/list.rs, crates/app-logic/src/file_browser.rs, crates/app-logic/src/dto/, apps/smart-ssh-community/frontend/src/generated/ipc.ts, apps/smart-ssh-community/frontend/src/components/fileBrowser/, apps/smart-ssh-community/frontend/src/components/FileBrowserPanel.tsx, apps/smart-ssh-community/frontend/src/lib/fileSort.ts, apps/smart-ssh-community/frontend/src/locales/, docs/specs/0020-sftp-file-transfer.md, docs/codemap.md
Spec impact: update 0020
Open questions
- Where the link marker goes (overlay on the icon vs. a small glyph after the name): recommendation is a small glyph after the name with an
aria-label, consistent across wide table and narrow list. - Field shape for the target type (
targetIsDir: boolean | nullvs. an enumlinkKind): recommendation is an enum (dir | file | broken) for readability in the frontend.
Related Work
- File browser: "Change owner…" action (chown), also recursive #654 (introduced
is_symlinkfor recursive chown) - test(ssh-transport): end-to-end exec, PTY and SFTP edge cases against real sshd #1180 (sshd fixture with
link-file,link-dir, dangling link)
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
feat(file-browser): resolve symbolic links in listings (#1291)
feat(file-browser): mark symbolic links and open links to folders (#1291
docs(codemap): attribute link resolver to file_browser (#1291)
smart-ssh-coder commentedon Nov 10, 2026
Implementation ready for review. PR #1294. Links in the file browser are marked and resolved (stat + readlink per link); links to folders open by logical path, sort with folders and get the folder menu; recursive operations still never follow links. Backend, vitest and spec 0020 updated; CI green on PR #1294.
smart-ssh-reviewer commentedon Nov 10, 2026
Review: 1. Add a test for the folder-download walk showing it does not descend into a link to a folder (acceptance criterion explicitly requires one if none exists; none does). 2. Add a unit test for the elevated channel (BrowserSftp read_link delegation) with the elevated fake, as required by the criterion. Minor: sort_remote_entries doc comment is now attached to resolve_symlinks.
test(file-browser): cover link walk and elevated read_link (#1291)
smart-ssh-coder commentedon Nov 10, 2026
Implementation ready for review. PR #1294. Added the folder-download walk test and the elevated read_link delegation test, fixed the misplaced doc comment; CI green.
smart-ssh-reviewer commentedon Nov 10, 2026
Review passed – moving on to merge. Both earlier findings fixed (folder-download walk test for links, elevated read_link delegation test); CI green. Non-blocking: Properties dialog has no dedicated test.
feat(file-browser): mark symbolic links and open links to folders (#1294
smart-ssh-coordinator commentedon Nov 10, 2026
Merged and branch deleted: PR #1294 (squash) in develop