From 7727fa09fbb2c0354f83eb6724aa5727fb62c413 Mon Sep 17 00:00:00 2001 From: LukeGus Date: Sun, 20 Sep 2026 19:06:52 -0500 Subject: [PATCH] fix: I can't send a file on its own. (#1304) https://github.com/Termix-SSH/Support/issues/1304 --- src/ui/features/file-manager/FileManager.tsx | 9 ++++++++- src/ui/features/sftp/SftpTransferTab.tsx | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ui/features/file-manager/FileManager.tsx b/src/ui/features/file-manager/FileManager.tsx index ce6c13fbc..00a8d8910 100644 --- a/src/ui/features/file-manager/FileManager.tsx +++ b/src/ui/features/file-manager/FileManager.tsx @@ -1921,13 +1921,20 @@ function FileManagerContent({ if (!sourceSessionId) return; const sourcePaths = files.map((f) => f.path); + const isSingleFile = files.length === 1 && files[0].type === "file"; + const base = currentPath.replace(/\/+$/, "") || "/"; + const destPath = isSingleFile + ? base.endsWith("/") + ? `${base}${files[0].name}` + : `${base}/${files[0].name}` + : base; try { const { transferId } = await transferToHost( sourceSessionId, sourcePaths, sshSessionId, - currentPath, + destPath, operation === "cut", "auto", 2, diff --git a/src/ui/features/sftp/SftpTransferTab.tsx b/src/ui/features/sftp/SftpTransferTab.tsx index c78bfccda..010ec0c26 100644 --- a/src/ui/features/sftp/SftpTransferTab.tsx +++ b/src/ui/features/sftp/SftpTransferTab.tsx @@ -717,13 +717,27 @@ export function SftpTransferTab() { return; } + let destTarget = destDir; + if (paths.length === 1) { + const sourceEntries = + sourcePane.sessionId === sourceSessionId + ? sourcePane.entries + : destPane.sessionId === sourceSessionId + ? destPane.entries + : []; + const entry = sourceEntries.find((e) => e.path === paths[0]); + if (entry && entry.type === "file") { + destTarget = joinRemotePath(destDir, entry.name); + } + } + setTransferring(true); try { const { transferId } = await transferToHost( sourceSessionId, paths, destinationSessionId, - destDir, + destTarget, moveFiles, "auto", );