File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -941,9 +941,7 @@ def __init__(self, policy=None):
941941 @property
942942 def is_attachment (self ):
943943 c_d = self .get ('content-disposition' )
944- if c_d is None :
945- return False
946- return c_d .lower () == 'attachment'
944+ return False if c_d is None else c_d .content_disposition == 'attachment'
947945
948946 def _find_body (self , part , preferencelist ):
949947 if part .is_attachment :
Original file line number Diff line number Diff line change @@ -729,7 +729,8 @@ def test_is_attachment(self):
729729 self .assertTrue (m .is_attachment )
730730 m .replace_header ('Content-Disposition' , 'AtTachMent' )
731731 self .assertTrue (m .is_attachment )
732-
732+ m .set_param ('filename' , 'abc.png' , 'Content-Disposition' )
733+ self .assertTrue (m .is_attachment )
733734
734735
735736class TestEmailMessage (TestEmailMessageBase , TestEmailBase ):
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ Core and Builtins
3232Library
3333-------
3434
35+ - Issue #21079: Fix email.message.EmailMessage.is_attachment to return the
36+ correct result when the header has parameters as well as a value.
37+
3538- Issue #22247: Add NNTPError to nntplib.__all__.
3639
3740- Issue #4180: The warnings registries are now reset when the filters
You can’t perform that action at this time.
0 commit comments