Handle Symlink in the File manager. #227
Reference in New Issue
Block a user
Delete Branch "feat/symlink"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fix handling of symlink when displayed in the File manager (#214 )
It identifies the type of target of symlink which is either file or directory and then accordingly moves ahead.
Summary by CodeRabbit
Walkthrough
Adds a new backend GET endpoint to identify symlinks over SSH, a UI API wrapper to call it, and UI logic to handle symlink clicks in the File Manager sidebar, resolving targets and navigating/opening accordingly. The backend route appears duplicated in the file.
Changes
src/backend/ssh/file-manager.ts/ssh/file_manager/ssh/identifySymlinkthat validatessessionIdandpath, executesstatandreadlinkvia the active SSH session, and returns{ path, target, type }. Handles errors and updates session activity. Note: route added twice (duplicate definition).src/ui/Desktop/Apps/File Manager/FileManagerLeftSidebar.tsxhandleSymlinkClick(item)for SSH symlink resolution. Differentiates items of type "link", uses a FileSymlink icon, resolves via API, navigates to directories or opens files, and expands toasts/labels to include "Link". Manages SSH session status and reconnection.src/ui/main-axios.tsidentifySSHSymlink(sessionId, path)that calls/ssh/identifySymlinkviafileManagerApiand returns `{ path, target, type: "directory"Sequence Diagram(s)
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks (2 passed, 1 warning)
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Comment
@coderabbitai helpto get the list of available commands and usage tips.Actionable comments posted: 2
🧹 Nitpick comments (2)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between
d4dc310c93andd5471d68a3.📒 Files selected for processing (3)
src/backend/ssh/file-manager.ts(1 hunks)src/ui/Desktop/Apps/File Manager/FileManagerLeftSidebar.tsx(8 hunks)src/ui/main-axios.ts(1 hunks)🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
⚙️ CodeRabbit configuration file
Files:
src/ui/main-axios.tssrc/backend/ssh/file-manager.tssrc/ui/Desktop/Apps/File Manager/FileManagerLeftSidebar.tsx**/main-axios.ts
⚙️ CodeRabbit configuration file
Files:
src/ui/main-axios.ts**/backend/**/*.{ts,js}
⚙️ CodeRabbit configuration file
Files:
src/backend/ssh/file-manager.ts🧬 Code graph analysis (1)
src/ui/Desktop/Apps/File Manager/FileManagerLeftSidebar.tsx (1)
🔇 Additional comments (6)
@@ -332,0 +374,4 @@`SSH identifySymlink command failed with code ${code}: ${errorData.replace(/\n/g, " ").trim()}`,);return res.status(500).json({ error: `Command failed: ${errorData}` });}🛠️ Refactor suggestion
Return a specific status for broken links.
If stderr contains “No such file or directory”, respond with 404 to let the UI show a clearer toast for broken symlinks instead of a generic 500.
Apply:
📝 Committable suggestion
🤖 Prompt for AI Agents
@@ -332,0 +393,4 @@});});});⚠️ Potential issue
Guard against missing/invalid path and harden output parsing.
decodeURIComponent is called before validating presence; undefined becomes the string "undefined" and the command runs against that path. Also, parsing assumes exactly two non-empty lines. Tighten both.
Apply:
📝 Committable suggestion
🤖 Prompt for AI Agents
I'll check out this PR soon. You caught me at a bad time since I just released a new version about 10 minutes before your PR. In the meantime, you can check out some of the possible issues that coderabbit mentioned (they may be insignificant or wrong, I haven't reviewed them).
Surely thank you. I was working in the dev branch but then saw you merged it so raised against main.