IMAP4Server fails with Content-Type with semicolon, but no parameters

[email protected]
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from biny <[email protected]>:

A test copied from testFetchBodyStructure:

{{{
    def testContentTypeSemicolon(self, uid=0):
        self.function = self.client.fetchBodyStructure
        self.messages = '3:9,10:*'
        self.msgObjs = [FakeyMessage({
                'content-type': 'text/plain;',
                'content-id': 'this-is-the-content-id',
                'content-description': 'describing-the-content-goes-here!',
                'content-transfer-encoding': '8BIT',
            }, (), '', 'Body\nText\nGoes\nHere\n', 919293, None)]
        self.expected = {0: {'BODYSTRUCTURE': [
            'text', 'plain', None,
            'this-is-the-content-id', 'describing-the-content-goes-here!',
            '8BIT', '20', '4', None, None, None]}}
        return self._fetchWork(uid)
}}}

causes a failure:

{{{
  File "/usr/lib/python2.6/site-packages/twisted/mail/imap4.py", line 4492, in getBodyStructure
    attrs = dict([x.strip().lower().split('=', 1) for x in mimetype[1:]])
exceptions.ValueError: dictionary update sequence element #0 has length 1; 2 is required
}}}

Can be fixed easily by adding "if x" to that list creation.

If I remember correctly, I noticed this in production usage and I had to patch it to be able to see the email. No, sadly I don't have that email available.


----------
Type     : defect
Component: mail
Keywords : 
Priority : normal
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/3950
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.