From 6419279c3c3e0a493297419cc9f3b7980d5ebb02 Mon Sep 17 00:00:00 2001 From: Quantum Date: Fri, 25 Jun 2021 19:48:53 -0400 Subject: [PATCH] [client] wayland/clipboard: prefer text/plain over text/html When both text/plain and text/html are available, we should prefer the plain text as we can't paste HTML. --- client/displayservers/Wayland/clipboard.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/displayservers/Wayland/clipboard.c b/client/displayservers/Wayland/clipboard.c index ad24c22e..616b9f13 100644 --- a/client/displayservers/Wayland/clipboard.c +++ b/client/displayservers/Wayland/clipboard.c @@ -210,9 +210,10 @@ static void dataOfferHandleOffer(void * opaque, struct wl_data_offer * offer, if (type == LG_CLIPBOARD_DATA_NONE) return; - // text/html represents rich text format and should not be used when an image - // format is available. - if (isImageCbtype(type) && data->mimetypes[LG_CLIPBOARD_DATA_TEXT] && + // text/html represents rich text format, which is almost never desirable when + // and should not be used when a plain text or image format is available. + if ((isImageCbtype(type) || containsMimetype(textMimetypes, mimetype)) && + data->mimetypes[LG_CLIPBOARD_DATA_TEXT] && strstr(data->mimetypes[LG_CLIPBOARD_DATA_TEXT], "html")) { free(data->mimetypes[LG_CLIPBOARD_DATA_TEXT]);