Skip to content

Bug: uniclip client receives two different content during one copy operation #35

Description

@playdougher

Description of the bug

Uniclip Server: Windows10
Uniclip Client: openSUSE

My operation is copy multiple lines on openSUSE, then paste on openSUSE. OpenSUSE gets two clipboard content, the first one is right content, but the second one has an extra \r\n instead of \n in each line

Verbose output (Use the --debug option)

I add two printf to debug.

a@dust|/home/a/Downloads/uniclip|$ go build; ./uniclip -d 10.0.2.2:37120

...
sent clipboard: "aa\nb\n"
verbose: [sent: aa
b
]
received clipboard: "aa\nb\n"
verbose: [rcvd: aa
b
]
received clipboard: "aa\r\nb\r\n"
verbose: [rcvd: aa
b
]
a@dust|/home/a/Downloads/uniclip|$ git -P log -2
commit 02f28f13455e219deb3c2d0be6352e405bb415ba (HEAD -> master, origin/master, origin/HEAD)
Merge: 4233ac0 bbdeec9
Author: Ishan Goel <igoel.mail@gmail.com>
Date:   Sat Mar 9 14:18:18 2024 -0800

    Merge pull request #25 from ericlinagora/add_listener_port_argument_option

commit bbdeec9c5aae84583b056e01d56d1b01fc7c03e2
Author: Eric Doughty-Papassideris <edoughtypapassideris@linagora.com>
Date:   Sat Mar 9 16:58:38 2024 +0100

    Add argument to specify listener port instead of random available
a@dust|/home/a/Downloads/uniclip|$ git -P diff
diff --git a/uniclip.go b/uniclip.go
index 8d131a6..593eab6 100644
--- a/uniclip.go
+++ b/uniclip.go
@@ -208,6 +208,7 @@ func MonitorSentClips(r *bufio.Reader) {
                //foreignClipboard = decompress(foreignClipboardBytes)
                setLocalClip(foreignClipboard)
                localClipboard = foreignClipboard
+               fmt.Printf("received clipboard: %q\n",foreignClipboard)
                debug("rcvd:", foreignClipboard)
                for i := range listOfClients {
                        if listOfClients[i] != nil {
@@ -239,6 +240,7 @@ func sendClipboard(w *bufio.Writer, clipboard string) error {
        if err != nil {
                return err
        }
+       fmt.Printf("sent clipboard: %q\n",clipboard)
        debug("sent:", clipboard)
        //if secure {
        //      debug("--secure is enabled, so actually sent as:", hex.EncodeToString(clipboardBytes))
a@dust|/home/a/Downloads/uniclip|$

Steps to Reproduce

  1. copy multiple lines and wait for 1 second
  2. check debug info of uniclip client. If can't see two "rcvd: xxx", try 1. again

Expected behavior

Received data should be the same with the sent data

OS and Uniclip version

Operating System: openSUSE Tumbleweed
CPE OS Name: cpe:2.3:o:opensuse:tumbleweed:20250313:::::::*
Kernel: Linux 6.13.6-1-default
Architecture: x86-64

uniclip version: dev

Additional info

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions