From b9c324586e44feec8559637eb4cfbb049e8bb2d3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 24 Jan 2023 18:30:46 +0530 Subject: [PATCH] Also recognize a few well known MIME types as being textual --- tools/cmd/clipboard/write.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/cmd/clipboard/write.go b/tools/cmd/clipboard/write.go index a3354bd62..115e82f7d 100644 --- a/tools/cmd/clipboard/write.go +++ b/tools/cmd/clipboard/write.go @@ -25,8 +25,17 @@ type Input struct { extra_mime_types []string } +var known_textual_mimes = map[string]bool{ + "application/x-sh": true, + "application/x-csh": true, + "application/x-shellscript": true, + "application/json": true, + "application/rss+xml": true, + "application/xhtml+xml": true, +} + func is_textual_mime(x string) bool { - return strings.HasPrefix(x, "text/") + return strings.HasPrefix(x, "text/") || known_textual_mimes[x] } func is_text_plain_mime(x string) bool {