Re: bug in MIME::Entity make_singlepart

2008-06-30 Thread Dave O'Neill
On Fri, Jun 27, 2008 at 11:37:56AM -0400, Ricardo SIGNES wrote:
 
 I think that it's documented, so it should keep working.  If nobody
 has asked for it to throw an error, it either isn't coming up or it's
 coming up and people accept it.
 
 I'd suggest adding an error-generating branch (with a different method name or
 an arg) or just removing the entire Content-* header set (since there is no
 content!) but I wouldn't need to use it, and who knows if anyone else would.

Ok, MIME::Entity now nukes all content-* when converting an empty
multipart to a singlepart.  Adding optional error-throwing is probably
too much effort for such a bizzare edgecase anyway.

The fix is in 5.427, which is currently winding its way through PAUSE.

Cheers,
Dave
-- 
Dave O'Neill [EMAIL PROTECTED]Roaring Penguin Software Inc.
+1 (613) 231-6599http://www.roaringpenguin.com/
For CanIt technical support, please mail: [EMAIL PROTECTED]


Re: bug in MIME::Entity make_singlepart

2008-06-27 Thread Dave O'Neill
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


Re: bug in MIME::Entity make_singlepart

2008-06-27 Thread Ricardo SIGNES
* Dave O'Neill [EMAIL PROTECTED] [2008-06-27T10:30:10]
 On Thu, Jun 26, 2008 at 01:37:09PM -0400, Ricardo SIGNES wrote:
Content-Type: multipart/related; boundary=xyzzy; type=foo
Content-Type: text/plain; boundary=xyzzy; type=foo
 
 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.

I think that it's documented, so it should keep working.  If nobody has asked
for it to throw an error, it either isn't coming up or it's coming up and
people accept it.

I'd suggest adding an error-generating branch (with a different method name or
an arg) or just removing the entire Content-* header set (since there is no
content!) but I wouldn't need to use it, and who knows if anyone else would.

I think the only problematic behavior is the bizarre (and presumably illegal)
leftover parameters.

-- 
rjbs