X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=mimedecode.py;h=5f3321c22fa73529108230a79516436cfa78e1cc;hb=3782c584d7ed8cc1abf70c2b5a6b5d1963366a2f;hp=e7381f78cdb495bc9a1aa765ef4c2ca116098fc1;hpb=ea094df666c1e2aa626d817d29dfd77acc52c5ea;p=mimedecode.git diff --git a/mimedecode.py b/mimedecode.py index e7381f7..5f3321c 100755 --- a/mimedecode.py +++ b/mimedecode.py @@ -247,12 +247,16 @@ def decode_body(msg, s): outfile.close() pipe = os.popen(command, 'r') - s = pipe.read() - pipe.close() + new_s = pipe.read() + if pipe.close() is None: # result=0, Ok + s = new_s os.remove(filename) set_content_type(msg, "text/plain") - msg["X-MIME-Autoconverted"] = "from %s to text/plain by %s id %s" % (content_type, g.host_name, command.split()[0]) + if s is new_s: + msg["X-MIME-Autoconverted"] = "from %s to text/plain by %s id %s" % (content_type, g.host_name, command.split()[0]) + else: + msg["X-MIME-Autoconverted"] = "failed conversion from %s to text/plain by %s id %s" % (content_type, g.host_name, command.split()[0]) return s