From a44ff7ee4b3adb10ba8f2dd326b6747750d73f8c Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Tue, 30 Apr 2019 22:15:20 +0200 Subject: [PATCH] Handle some more attachment types (some of them bogus) --- mbox2web | 6 ++++++ templates/attachment_application_pgp-keys.html | 9 +++++++++ templates/attachment_application_x-gunzip.html | 9 +++++++++ templates/attachment_application_x-java-vm.html | 9 +++++++++ templates/attachment_image_jpeg.html | 8 ++++++++ templates/attachment_image_png.html | 8 ++++++++ 6 files changed, 49 insertions(+) create mode 100644 templates/attachment_application_pgp-keys.html create mode 100644 templates/attachment_application_x-gunzip.html create mode 100644 templates/attachment_application_x-java-vm.html create mode 100644 templates/attachment_image_jpeg.html create mode 100644 templates/attachment_image_png.html diff --git a/mbox2web b/mbox2web index 53b6a4c..c100bed 100755 --- a/mbox2web +++ b/mbox2web @@ -88,6 +88,11 @@ def save_part(msg, disposition): "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-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] name = msg.get_param("name") or "(data)" @@ -333,6 +338,7 @@ def render_body(msg, extra=None): "message/news": render_message_news, "image/gif": render_image_gif, "multipart/related": render_multipart_related, + "application/x-java-vm": render_application_octet_stream, } content_type = msg.get_content_type() content_disposition = msg.get_content_disposition() diff --git a/templates/attachment_application_pgp-keys.html b/templates/attachment_application_pgp-keys.html new file mode 100644 index 0000000..2778d03 --- /dev/null +++ b/templates/attachment_application_pgp-keys.html @@ -0,0 +1,9 @@ +
+
+ application/pgp-keys +
+
+ {{name}} +
+
+ diff --git a/templates/attachment_application_x-gunzip.html b/templates/attachment_application_x-gunzip.html new file mode 100644 index 0000000..912dcd2 --- /dev/null +++ b/templates/attachment_application_x-gunzip.html @@ -0,0 +1,9 @@ +
+
+ application/x-gzip +
+
+ {{name}} +
+
+ diff --git a/templates/attachment_application_x-java-vm.html b/templates/attachment_application_x-java-vm.html new file mode 100644 index 0000000..4252590 --- /dev/null +++ b/templates/attachment_application_x-java-vm.html @@ -0,0 +1,9 @@ +
+
+ application/x-java-vm +
+
+ {{name}} +
+
+ diff --git a/templates/attachment_image_jpeg.html b/templates/attachment_image_jpeg.html new file mode 100644 index 0000000..61d2de1 --- /dev/null +++ b/templates/attachment_image_jpeg.html @@ -0,0 +1,8 @@ +
1000 +
+ image/png +
+
+ {{name}} +
+
diff --git a/templates/attachment_image_png.html b/templates/attachment_image_png.html new file mode 100644 index 0000000..61d2de1 --- /dev/null +++ b/templates/attachment_image_png.html @@ -0,0 +1,8 @@ +
1000 +
+ image/png +
+
+ {{name}} +
+