Skip to content

Commit

Permalink
don't transfer portal stuff
Browse files Browse the repository at this point in the history
as it needs dbus to work, and we don't forward dbus

discard the 'extra' ones early, it may help prevent some applications requesting them

also add some docstrings
  • Loading branch information
totaam committed Dec 13, 2024
1 parent 090a820 commit e09b074
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xpra/clipboard/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def get_discard_targets(envname: str = "DISCARD", default_value: Iterable[str] =
r"^dyn\.",
r"^resource-transfer-format", # eclipse
r"^x-special/", # ie: gnome file copy
r"^application/vnd.portal.", # portal uses dbus, which is not forwarded
)
))
# targets some applications are known to request,
Expand Down Expand Up @@ -103,7 +104,7 @@ def must_discard_extra(target: str) -> bool:

def _filter_targets(targets: Iterable[str]) -> Sequence[str]:
targets_strs = tuple(bytestostr(x) for x in targets)
f = tuple(target for target in targets_strs if not must_discard(target))
f = tuple(target for target in targets_strs if not (must_discard(target) or must_discard_extra(target)))
log("_filter_targets(%s)=%s", csv(targets_strs), f)
return f

Expand Down Expand Up @@ -529,9 +530,11 @@ def _process_clipboard_token(self, packet: PacketType) -> None:
proxy.got_token(targets, target_data, claim, synchronous_client)

def local_targets(self, remote_targets: Iterable[str]) -> Sequence[str]:
""" filter remote targets to values that can be used locally """
return _filter_targets(remote_targets)

def remote_targets(self, local_targets: Iterable[str]) -> Sequence[str]:
""" export local targets """
return _filter_targets(local_targets)

def _munge_raw_selection_to_wire(self, target: str, dtype: str, dformat: int, data) -> tuple[Any, Any]:
Expand Down

0 comments on commit e09b074

Please sign in to comment.