fix: file transfer, show error, msgbox (#9389)

* fix: file transfer, show error, msgbox

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: translation

Signed-off-by: fufesou <linlong1266@gmail.com>

---------

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2024-09-18 19:29:35 +08:00
committed by GitHub
parent e5ec6957fe
commit d08c335fdf
46 changed files with 88 additions and 15 deletions

View File

@@ -2139,22 +2139,34 @@ impl Connection {
return true;
}
if crate::get_builtin_option(keys::OPTION_ONE_WAY_FILE_TRANSFER) == "Y" {
match fa.union {
Some(file_action::Union::Send(_))
| Some(file_action::Union::RemoveFile(_))
| Some(file_action::Union::Rename(_))
| Some(file_action::Union::Create(_))
| Some(file_action::Union::RemoveDir(_)) => {
self.send(fs::new_error(
0,
"One-way file transfer is enabled on controlled side",
0,
))
.await;
return true;
let mut job_id = None;
match &fa.union {
Some(file_action::Union::Send(s)) => {
job_id = Some(s.id);
}
Some(file_action::Union::RemoveFile(rf)) => {
job_id = Some(rf.id);
}
Some(file_action::Union::Rename(r)) => {
job_id = Some(r.id);
}
Some(file_action::Union::Create(c)) => {
job_id = Some(c.id);
}
Some(file_action::Union::RemoveDir(rd)) => {
job_id = Some(rd.id);
}
_ => {}
}
if let Some(job_id) = job_id {
self.send(fs::new_error(
job_id,
"one-way-file-transfer-tip",
0,
))
.await;
return true;
}
}
match fa.union {
Some(file_action::Union::ReadDir(rd)) => {