Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix: option OPTION_ONE_WAY_FILE_TRANSFER (#9387)

fufesoue5ec6957fe86
diff --git a/libs/clipboard/src/lib.rs b/libs/clipboard/src/lib.rs
index a5da25512..30055740e 100644
--- a/libs/clipboard/src/lib.rs
+++ b/libs/clipboard/src/lib.rs
@@ -132,7 +132,7 @@ impl ClipboardFile {
)
}
- pub fn is_stopping_allowed_from_peer(&self) -> bool {
+ pub fn is_beginning_message(&self) -> bool {
matches!(
self,
ClipboardFile::MonitorReady | ClipboardFile::FormatList { .. }
diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs
index 46eb6f546..c23c967b5 100644
--- a/src/client/io_loop.rs
+++ b/src/client/io_loop.rs
@@ -1895,7 +1895,7 @@ impl<T: InvokeUiSession> Remote<T> {
return;
};
- let is_stopping_allowed = clip.is_stopping_allowed_from_peer();
+ let is_stopping_allowed = clip.is_beginning_message();
let file_transfer_enabled = self.handler.lc.read().unwrap().enable_file_copy_paste.v;
let stop = is_stopping_allowed && !file_transfer_enabled;
log::debug!(
diff --git a/src/ui_cm_interface.rs b/src/ui_cm_interface.rs
index e75683d8a..549798a51 100644
--- a/src/ui_cm_interface.rs
+++ b/src/ui_cm_interface.rs
@@ -440,7 +440,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
Data::ClipboardFile(_clip) => {
#[cfg(any(target_os = "windows", target_os="linux", target_os = "macos"))]
{
- let is_stopping_allowed = _clip.is_stopping_allowed_from_peer();
+ let is_stopping_allowed = _clip.is_beginning_message();
let is_clipboard_enabled = ContextSend::is_enabled();
let file_transfer_enabled = self.file_transfer_enabled;
let stop = !is_stopping_allowed && !(is_clipboard_enabled && file_transfer_enabled);
@@ -565,10 +565,15 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
log::debug!(
"Process clipboard message from clip, stop: {}, is_stopping_allowed: {}, is_clipboard_enabled: {}, file_transfer_enabled: {}, file_transfer_enabled_peer: {}",
stop, is_stopping_allowed, is_clipboard_enabled, file_transfer_enabled, file_transfer_enabled_peer);
- if stop || crate::get_builtin_option(OPTION_ONE_WAY_FILE_TRANSFER) == "Y"{
+ if stop {
ContextSend::set_is_stopped();
} else {
- allow_err!(self.tx.send(Data::ClipboardFile(_clip)));
+ if _clip.is_beginning_message() && crate::get_builtin_option(OPTION_ONE_WAY_FILE_TRANSFER) == "Y" {
+ // If one way file transfer is enabled, don't send clipboard file to client
+ // Don't call `ContextSend::set_is_stopped()`, because it will stop bidirectional file copy&paste.
+ } else {
+ allow_err!(self.tx.send(Data::ClipboardFile(_clip)));
+ }
}
}
}