Also treat some more mimetypes as text
This commit is contained in:
@@ -25,18 +25,28 @@ BINARY = {
|
||||
".zst",
|
||||
}
|
||||
|
||||
TEXT_MIMETYPES = {
|
||||
"message/rfc822",
|
||||
"application/pgp-keys",
|
||||
"application/x-gnupg-keyring",
|
||||
}
|
||||
|
||||
|
||||
def is_text_mimetype(mimetype):
|
||||
if mimetype.startswith("text/"):
|
||||
return True
|
||||
|
||||
return mimetype.split(";")[0] in TEXT_MIMETYPES
|
||||
|
||||
|
||||
def is_binary_or_large(filename, size):
|
||||
"""Decide if is a binary file based on the extension or size"""
|
||||
binary_suffix = BINARY
|
||||
non_binary_suffix = {
|
||||
".1",
|
||||
".8",
|
||||
".SUSE",
|
||||
".asc",
|
||||
".c",
|
||||
".cabal",
|
||||
".cfg",
|
||||
".changes",
|
||||
".conf",
|
||||
".desktop",
|
||||
|
Reference in New Issue
Block a user