Also recognize a few well known MIME types as being textual
This commit is contained in:
parent
41fb3c79c5
commit
b9c324586e
@ -25,8 +25,17 @@ type Input struct {
|
|||||||
extra_mime_types []string
|
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 {
|
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 {
|
func is_text_plain_mime(x string) bool {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user