@@ -668,6 +668,35 @@ def testNewIssueNoAuthorEmail(self):
668668_______________________________________________________________________
669669''' )
670670
671+ octetstream_msg = '''From: mary <[email protected] > 672+ 673+ Message-Id: <followup_dummy_id>
674+ In-Reply-To: <dummy_test_message_id>
675+ Subject: [issue1] Testing...
676+ Content-Type: multipart/mixed; boundary="uh56ypi7view24rr"
677+ Content-Disposition: inline
678+
679+ --uh56ypi7view24rr
680+ Content-Type: text/plain; charset=us-ascii
681+ Content-Disposition: inline
682+
683+ Attach a file with non-ascii characters in it (encoded latin-1 should
684+ make it as-is through roundup due to Content-Type
685+ application/octet-stream)
686+ --
687+ Ralf Schlatterbeck email: [email protected] 688+
689+ --uh56ypi7view24rr
690+ Content-Type: application/octet-stream
691+ Content-Disposition: attachment; filename=testfile
692+ Content-Transfer-Encoding: quoted-printable
693+
694+ This is a file containing text
695+ in latin-1 format =E4=F6=FC=C4=D6=DC=DF
696+
697+ --uh56ypi7view24rr--
698+ '''
699+
671700 multipart_msg = '''From: mary <[email protected] > 672701673702Message-Id: <followup_dummy_id>
@@ -803,6 +832,22 @@ def testNewIssueNoAuthorEmail(self):
803832--001485f339f8f361fb049188dbba--
804833'''
805834
835+ def testOctetStreamTranscoding (self ):
836+ self .doNewIssue ()
837+ self ._handle_mail (self .octetstream_msg )
838+ messages = self .db .issue .get ('1' , 'messages' )
839+ messages .sort ()
840+ msg = self .db .msg .getnode (messages [- 1 ])
841+ assert (len (msg .files ) == 1 )
842+ names = {0 : 'testfile' }
843+ content = ['''This is a file containing text
844+ in latin-1 format \xE4 \xF6 \xFC \xC4 \xD6 \xDC \xDF
845+ ''' ]
846+ for n , id in enumerate (msg .files ):
847+ f = self .db .file .getnode (id )
848+ self .assertEqual (f .name , names .get (n , 'unnamed' ))
849+ self .assertEqual (f .content , content [n ])
850+
806851 def testMultipartKeepAlternatives (self ):
807852 self .doNewIssue ()
808853 self ._handle_mail (self .multipart_msg )
0 commit comments