Also recognize a few well known MIME types as being textual

This commit is contained in:
Kovid Goyal 2023-01-24 18:30:46 +05:30
parent 41fb3c79c5
commit b9c324586e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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 {