mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +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;
|
if (!sourceSessionId) return;
|
||||||
|
|
||||||
const sourcePaths = files.map((f) => f.path);
|
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 {
|
try {
|
||||||
const { transferId } = await transferToHost(
|
const { transferId } = await transferToHost(
|
||||||
sourceSessionId,
|
sourceSessionId,
|
||||||
sourcePaths,
|
sourcePaths,
|
||||||
sshSessionId,
|
sshSessionId,
|
||||||
currentPath,
|
destPath,
|
||||||
operation === "cut",
|
operation === "cut",
|
||||||
"auto",
|
"auto",
|
||||||
2,
|
2,
|
||||||
|
|||||||
@@ -717,13 +717,27 @@ export function SftpTransferTab() {
|
|||||||
return;
|
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);
|
setTransferring(true);
|
||||||
try {
|
try {
|
||||||
const { transferId } = await transferToHost(
|
const { transferId } = await transferToHost(
|
||||||
sourceSessionId,
|
sourceSessionId,
|
||||||
paths,
|
paths,
|
||||||
destinationSessionId,
|
destinationSessionId,
|
||||||
destDir,
|
destTarget,
|
||||||
moveFiles,
|
moveFiles,
|
||||||
"auto",
|
"auto",
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user