mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-08 21:03:46 +00:00
fix: I can't send a file on its own. (#1304)
https://github.com/Termix-SSH/Support/issues/1304
This commit is contained in:
1 parent
e9fd092ebd
commit
7727fa09fb
2 files changed
+23
-2
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user