On Thu, Jun 26, 2008 at 01:37:09PM -0400, Ricardo SIGNES wrote:
> 
> Sometimes, when collapsing a message into single part, the C-T is horked up.
> 
> It starts as:
> 
>   Content-Type: multipart/related; boundary=xyzzy; type=foo
> 
> ...and ends as:
> 
>   Content-Type: text/plain; boundary=xyzzy; type=foo
> 
> Erk!  Boundary?  Type?  What?

So, there are two possible fixes.

One, nuke all those extra attributes from Content-Type before setting it
to text/plain.  Simple to do, and doesn't appear to break anything else.

Two, have make_singlepart() return an error (or preferably, die... but
MIME-tools doesn't really do exceptions) if you try to collapse a
zero-part multipart into a single part.  Also simple to implement, but
would break documented behaviour.

The docs for make_singlepart say "Also crunches 0-part multiparts into
singleparts", so the first option is probably the safest for backwards
compatibility.  However, it does seem nonsensical to convert an empty
multipart/* part into a text/plain.  Is this a case that's frequently
encountered?  If not, maybe it's OK to change that behavior.

Thoughts?

Dave

Reply via email to