Handle application/x-shellscript attachments

This commit is contained in:
Peter J. Holzer 2019-04-29 21:22:03 +02:00
parent 2aadb830cd
commit 54290fb668
2 changed files with 20 additions and 11 deletions

View File

@ -54,17 +54,18 @@ def render_message(msg):
def save_part(msg, disposition): def save_part(msg, disposition):
content_type = msg.get_content_type() content_type = msg.get_content_type()
extension = { extension = {
"application/octet-stream": ".bin", "application/octet-stream": ".bin",
"text/html": ".html", "text/html": ".html",
"text/x-vcard": ".vcf", "text/x-vcard": ".vcf",
"text/plain": ".txt", "text/plain": ".txt",
"application/x-gzip": ".gz", # more likely tar.gz, but we can't know without looking into it which we ain't "application/x-gzip": ".gz", # more likely tar.gz, but we can't know without looking into it which we ain't
"image/gif": ".gif", "image/gif": ".gif",
"text/x-c": ".c", "text/x-c": ".c",
"application/x-perl": ".pl", "application/x-perl": ".pl",
"application/msword": ".doc", "application/msword": ".doc",
"application/ms-tnef": ".ms-tnef", "application/ms-tnef": ".ms-tnef",
"application/x-bzip2": ".bz2", # more likely tar.bz2, but we can't know without looking into it which we ain't "application/x-bzip2": ".bz2", # more likely tar.bz2, but we can't know without looking into it which we ain't
"application/x-shellscript": ".sh",
}[content_type] }[content_type]
name = msg.get_param("name") or "(data)" name = msg.get_param("name") or "(data)"

View File

@ -0,0 +1,8 @@
<div class="partouter">
<div class="partheader">
application/x-shellscript
</div>
<div class="partinner">
<a href="{{url}}">{{name}}</a>
</div>
</div>