wl-clipboard icon indicating copy to clipboard operation
wl-clipboard copied to clipboard

Treat application/pgp-encrypted as text

Open vinliao opened this issue 5 years ago • 3 comments

Copying signed message works well, but wl-clipboard copies nothing when it's used on signed+encrypted text.

Steps to reproduce

  1. Create a file called msg.txt with the content hello world.
  2. Sign with private key
  3. Encrypt
  4. Run cat signed-and-encrypted.asc | wl-copy
  5. Try pasting. Nothing happens.

Here's an example of a signed and encrypted message. You can create a file with this as a content, then try copying it with wl-copy.

-----BEGIN PGP MESSAGE-----

hQIMA0sMAuCg7XG9ARAArC4rC+R4mwXEEgtGo4VmAv5mPdzWvbAdKRx/NVJl0g8e
YM4P03+Pofa655GGx8ZOD+fVKSFrn9yfiUJru2bR6svNbR/wOAS5II4SCpxD91vT
WIpSjaeUNRejqqvNSGXJabcVxtXrA/tAoQNrcnOV9N3CM5OmOd4vPN1xUj77Ui8b
0t/oFADSWrdYoabyIoj9dbmYuBYKzFOKE3KKnd2GColsWimMAv0aKQhChV9NEoeh
4JS1Vpo/xqB9HRyNSkrD3TY0vwYJiyYWjNb15+tCTqDtzJAMetMrexqMMVnPiQ2H
m/u3N9+urD+VA7RNF/piGQsp+9NEECDQo+A+LMVHgPUUGMqDY/u0kXKXhqosv81l
jNu6i61cRRdoXrNoAxdOfWbfLdAFCBvVdWc2VnIXqgJryPR3xb7qI+xzt0Emgviv
kX5euF1xwzYuqOd55qpaP5TY3d1pkSupTEUv4WDWX7j+K8T00nHUKdW/ghDqUQTL
YthteKf9Obwoz5sfzmuzcFkvVZem1dFL29GiFucyyZRR/GLBltBbcTpcq/7R7R+c
myn77OWi1cAnM50uQrS9I0OFmteEUPE78HWtZz/BVwpW+sAxP/HQuR9PytJWH7LR
6TZ6DtOeWQEz5kNDJlDQX91Z6+4kG7UtBlK5ujeDMCKSiIdBuAoZAJkV4xg7nPbS
6QGPsRk66xvqytpJiXMkI9f+Fh6mwka2BZnQhRmWgp79pKwVol8Qa3RHRAxW4um1
gnh+4/JEx5W9GzTHEKmtJZ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ao avatar Nov 14 '20 03:11 vinliao

Hi!

I can successfully copy and paste your example. Is there any reason you believe that copying doesn't work?

$ wl-copy < example.asc
$ wl-paste | head -3
-----BEGIN PGP MESSAGE-----

hQIMA0sMAuCg7XG9ARAArC4rC+R4mwXEEgtGo4VmAv5mPdzWvbAdKRx/NVJl0g8e
$ wl-paste --list-types
application/pgp-encrypted

Perhaps the program you're trying to paste into doesn't recognize application/pgp-encrypted as something it can paste. You can force the MIME type to be, say, text/plain, like this:

$ wl-copy < example.asc --type text/plain

That should be enough to convince other clients that only accept text to paste your encrypted text. I should probably add yet another special case to do this automatically...

bugaevc avatar Nov 14 '20 09:11 bugaevc

Oh yeah, adding --type text/plain works.

(And oh, thanks for showing me that you can use the < operator. That's a pretty cool alternative to cat & pipe.)

vinliao avatar Nov 15 '20 14:11 vinliao

I've noticed this as well, when trying to paste the contents of a .asc file into a github issue. Interestingly, firefox turns it into a garble of Chinese characters.

setpill avatar Jan 29 '21 10:01 setpill