Comment 3 for bug 874342

Revision history for this message
Scott Moser (smoser) wrote :

ok. I just tested that part-handler are now getting "raw" payload if they encoded with base64 and set the content type encoding to 'base64'.

I tested just now like this:
$ write-mime-multipart --gzip -o out.gz part-handler /bin/true:application/octet-stream /etc/passwd:text/plain /bin/sleep:application/octet-stream

where part-handler has:

#part-handler
import base64
def list_types():
    return(["application/octet-stream"])
def handle_part(data,ctype,filename,payload):
    if ctype == "__end__" or ctype == "__begin__": return
    if ctype == "application/octet-stream":
        stream = "%s/%s" % ('/tmp/',filename)
        f = open(stream, 'wb')
        f.write(payload)
        f.close()

The result is that there are /tmp/sleep and /tmp/true with content as they should have.

So, to be clear, this will break part-handlers that were expecting the base64 double encoding.