FIX: Resolve symlink double-click behavior in file manager

Root cause: Duplicate handleFileOpen function definitions caused symlinks
to be treated as regular files instead of navigating to their targets.

Problem:
- Line 575: Correct implementation with symlink handling
- Line 1401: Incorrect duplicate that overrode the correct function
- Double-clicking symlinks opened them as files instead of following links

Solution:
- Removed duplicate handleFileOpen function (lines 1401-1436)
- Preserved correct implementation with symlink navigation logic
- Added recordRecentFile call for consistency

Now symlinks properly:
- Navigate to target directories when they point to folders
- Open target files when they point to files
- Use identifySSHSymlink backend API for resolution

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZcR
2025-09-24 04:37:13 +08:00
parent 3c1aeef47e
commit a96659f4d2

View File

@@ -585,6 +585,9 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) {
return;
}
// Record to recent access for regular files
await recordRecentFile(file);
// Calculate window position (slightly offset)
const windowCount = Date.now() % 10; // Simple offset calculation
const offsetX = 120 + windowCount * 30;
@@ -1397,43 +1400,6 @@ function FileManagerContent({ initialHost, onClose }: FileManagerModernProps) {
await handleFileOpen(file);
}
// Handle file opening
async function handleFileOpen(file: FileItem) {
if (file.type === "directory") {
// If it's a directory, switch to that directory
setCurrentPath(file.path);
} else {
// If it's a file, record to recent access and open file window
await recordRecentFile(file);
// Create file window
const windowCount = Date.now() % 10;
const offsetX = 100 + windowCount * 30;
const offsetY = 100 + windowCount * 30;
const createFileWindow = (windowId: string) => (
<FileWindow
windowId={windowId}
file={file}
sshHost={currentHost!}
sshSessionId={sshSessionId!}
initialX={offsetX}
initialY={offsetY}
/>
);
openWindow({
title: file.name,
x: offsetX,
y: offsetY,
width: 800,
height: 600,
isMaximized: false,
isMinimized: false,
component: createFileWindow,
});
}
}
// Load pinned files list (when host or connection changes)
useEffect(() => {