Handle plaintext and gzipped attachments
This commit is contained in:
parent
48fcf768ae
commit
d32c60a318
9
mbox2web
9
mbox2web
|
@ -54,8 +54,10 @@ def save_part(msg):
|
|||
content_type = msg.get_content_type()
|
||||
extension = {
|
||||
"application/octet-stream": ".bin",
|
||||
"text/html": ".html",
|
||||
"text/x-vcard": ".vcf",
|
||||
"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
|
||||
}[content_type]
|
||||
|
||||
name = msg.get_param("name") or "(data)"
|
||||
|
@ -238,6 +240,9 @@ def render_body(msg):
|
|||
}
|
||||
bodyhtml = bodytmpl.render(context)
|
||||
|
||||
elif content_type == "application/x-gzip":
|
||||
bodyhtml = save_part(msg)
|
||||
|
||||
else:
|
||||
raise RuntimeError("Content-type " + content_type + " not implemented yet")
|
||||
|
||||
|
|
Loading…
Reference in New Issue