From 82cc22b70712ceeac7df87cab16bab9c91593d28 Mon Sep 17 00:00:00 2001 From: Alexandre Vallette Date: Mon, 8 Dec 2014 14:54:34 +0100 Subject: [PATCH] limited image formats --- check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check.py b/check.py index d4040a9..2b45340 100644 --- a/check.py +++ b/check.py @@ -48,7 +48,7 @@ # process images and add them to answer for part in msg.walk(): atype, fformat = part.get_content_type().split("/") - if atype == "image": + if atype == "image" and (fformat in ["jpeg", "png", "jpg"]): open('attachment.' + fformat, 'wb').write(part.get_payload(decode=True)) check_call(["python", os.path.abspath("scan.py"), "-i", os.path.abspath("attachment." + fformat), "-b", bw, "-a", a4]) img_data = open(os.path.abspath("out.pdf"), 'rb').read()