File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -862,7 +862,7 @@ def get_boundary(self, failobj=None):
862862        parameter, and it is unquoted. 
863863        """ 
864864        missing  =  object ()
865-         boundary  =  self .get_param ('boundary' , missing )
865+         boundary  =  self .get_param ('boundary' , missing ,  unquote = False )
866866        if  boundary  is  missing :
867867            return  failobj 
868868        # RFC 2046 says that boundaries may begin but not end in w/s 
Original file line number Diff line number Diff line change @@ -2209,6 +2209,42 @@ def test_boundary_with_leading_space(self):
22092209        eq (msg .get_boundary (), '    XXXX' )
22102210        eq (len (msg .get_payload ()), 2 )
22112211
2212+     def  test_boundary_stripped_only_once (self ):
2213+         eq  =  self .assertEqual 
2214+         msg  =  email .message_from_string ('''\  
2215+ 
2216+ Content-Type: multipart/mixed; boundary="<>" 
2217+ 
2218+ --<> 
2219+ Content-Type: text/plain 
2220+ 
2221+ 
2222+ --<> 
2223+ Content-Type: text/plain 
2224+ 
2225+ --<>-- 
2226+ ''' )
2227+         self .assertTrue (msg .is_multipart ())
2228+         eq (msg .get_boundary (), '<>' )
2229+         eq (len (msg .get_payload ()), 2 )
2230+ 
2231+         msg  =  email .message_from_string ('''\  
2232+ 
2233+ Content-Type: multipart/mixed; boundary=<""> 
2234+ 
2235+ --"" 
2236+ Content-Type: text/plain 
2237+ 
2238+ 
2239+ --"" 
2240+ Content-Type: text/plain 
2241+ 
2242+ --""-- 
2243+ ''' )
2244+         self .assertTrue (msg .is_multipart ())
2245+         eq (msg .get_boundary (), '""' )
2246+         eq (len (msg .get_payload ()), 2 )
2247+ 
22122248    def  test_boundary_without_trailing_newline (self ):
22132249        m  =  Parser ().parsestr ("""\  
22142250
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments