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

Copying text from STDIN does not work if the text starts with `MM`

Open jzjsuper opened this issue 6 months ago • 1 comments

Issue and Steps to reproduce

$ echo -n MM | wl-copy $ echo -n MMm | wl-copy

It's expected that MM / MMm will be copied to clipboard, but actually nothing will be copied to clipboard.

Causes

I think this is caused by xdg-mime misidentifying the file type when a text file starts with MM.

$ echo -n MM > text
$ xdg-mime query filetype text
image/x-3ds

Versions

OS: Arch Linux x86_64

$ wl-copy -v
wl-clipboard 2.2.1
Copyright (C) 2018-2023 Sergey Bugaev
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ xdg-mime --version
xdg-mime 1.2.1

jzjsuper avatar Aug 19 '25 03:08 jzjsuper

Hi,

I think this is caused by xdg-mime misidentifying the file type when a text file starts with MM.

Sounds so indeed. You should report it to them, and in the meantime, either copy it through argv (wl-copy MMm) or set the type using --type "text/plain;charset=utf-8"

bugaevc avatar Sep 02 '25 15:09 bugaevc