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()
|
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",
|
||||||
|
"application/x-gzip": ".gz", # more likely tar.gz, but we can't know without looking into it which we ain't
|
||||||
}[content_type]
|
}[content_type]
|
||||||
|
|
||||||
name = msg.get_param("name") or "(data)"
|
name = msg.get_param("name") or "(data)"
|
||||||
|
@ -238,6 +240,9 @@ def render_body(msg):
|
||||||
}
|
}
|
||||||
bodyhtml = bodytmpl.render(context)
|
bodyhtml = bodytmpl.render(context)
|
||||||
|
|
||||||
|
elif content_type == "application/x-gzip":
|
||||||
|
bodyhtml = save_part(msg)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Content-type " + content_type + " not implemented yet")
|
raise RuntimeError("Content-type " + content_type + " not implemented yet")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue