Handle some more attachment types (some of them bogus)

This commit is contained in:
Peter J. Holzer 2019-04-30 22:15:20 +02:00
parent 8d78b2ec26
commit a44ff7ee4b
6 changed files with 49 additions and 0 deletions

View File

@ -88,6 +88,11 @@ def save_part(msg, disposition):
"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", "application/x-shellscript": ".sh",
"application/x-java-vm": ".bin", # The only instances are mis-labelled
"image/png": ".png",
"application/pgp-keys": ".pgp",
"application/x-gunzip": ".gz", # that sort of makes sense, but not really
"image/jpeg": ".jpg",
}[content_type] }[content_type]
name = msg.get_param("name") or "(data)" name = msg.get_param("name") or "(data)"
@ -333,6 +338,7 @@ def render_body(msg, extra=None):
"message/news": render_message_news, "message/news": render_message_news,
"image/gif": render_image_gif, "image/gif": render_image_gif,
"multipart/related": render_multipart_related, "multipart/related": render_multipart_related,
"application/x-java-vm": render_application_octet_stream,
} }
content_type = msg.get_content_type() content_type = msg.get_content_type()
content_disposition = msg.get_content_disposition() content_disposition = msg.get_content_disposition()

View File

@ -0,0 +1,9 @@
<div class="partouter">
<div class="partheader">
application/pgp-keys
</div>
<div class="partinner">
<a href="{{url}}">{{name}}</a>
</div>
</div>

View File

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

View File

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

View File

@ -0,0 +1,8 @@
<div class="partouter"> 1000
<div class="partheader">
image/png
</div>
<div class="partinner">
<a href="{{url}}">{{name}}</a>
</div>
</div>

View File

@ -0,0 +1,8 @@
<div class="partouter"> 1000
<div class="partheader">
image/png
</div>
<div class="partinner">
<a href="{{url}}">{{name}}</a>
</div>
</div>