Implement attachment application/vnd.oasis.opendocument.text

This commit is contained in:
Peter J. Holzer 2019-05-12 23:06:52 +02:00
parent c9ccb38eb9
commit 10fc5e2f61
2 changed files with 33 additions and 23 deletions

View File

@ -76,29 +76,30 @@ def render_message(msg):
def save_part(msg, disposition):
content_type = msg.get_content_type()
extension = {
"application/octet-stream": ".bin",
"text/html": ".html",
"text/x-vcard": ".vcf",
"text/plain": ".txt",
"application/x-gzip": ".gz", # more likely tar.gz, but we can't know without looking into it which we ain't
"image/gif": ".gif",
"text/x-c": ".c",
"application/x-perl": ".pl",
"application/msword": ".doc",
"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",
"text/x-python": ".py",
"text/x-java": ".java",
"application/x-sh": ".sh",
"text/x-patch": ".patch",
"text/x-c++src": ".c++",
"application/x-compressed-tar": ".tar.gz",
"application/octet-stream": ".bin",
"text/html": ".html",
"text/x-vcard": ".vcf",
"text/plain": ".txt",
"application/x-gzip": ".gz", # more likely tar.gz, but we can't know without looking into it which we ain't
"image/gif": ".gif",
"text/x-c": ".c",
"application/x-perl": ".pl",
"application/msword": ".doc",
"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",
"text/x-python": ".py",
"text/x-java": ".java",
"application/x-sh": ".sh",
"text/x-patch": ".patch",
"text/x-c++src": ".c++",
"application/x-compressed-tar": ".tar.gz",
"application/vnd.oasis.opendocument.text": ".odt",
}[content_type]
name = msg.get_param("name") or "(data)"

View File

@ -0,0 +1,9 @@
<div class="partouter">
<div class="partheader">
application/vnd.oasis.opendocument.text
</div>
<div class="partinner">
<a href="{{url}}">{{name}}</a>
</div>
</div>