File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -941,9 +941,7 @@ def __init__(self, policy=None):
941
941
@property
942
942
def is_attachment (self ):
943
943
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'
947
945
948
946
def _find_body (self , part , preferencelist ):
949
947
if part .is_attachment :
Original file line number Diff line number Diff line change @@ -729,7 +729,8 @@ def test_is_attachment(self):
729
729
self .assertTrue (m .is_attachment )
730
730
m .replace_header ('Content-Disposition' , 'AtTachMent' )
731
731
self .assertTrue (m .is_attachment )
732
-
732
+ m .set_param ('filename' , 'abc.png' , 'Content-Disposition' )
733
+ self .assertTrue (m .is_attachment )
733
734
734
735
735
736
class TestEmailMessage (TestEmailMessageBase , TestEmailBase ):
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ Core and Builtins
32
32
Library
33
33
-------
34
34
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
+
35
38
- Issue #22247: Add NNTPError to nntplib.__all__.
36
39
37
40
- Issue #4180: The warnings registries are now reset when the filters
You can’t perform that action at this time.
0 commit comments