mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Merge #15232: correctly mangle From lines in MIME preamble and epilogue
This commit is contained in:
commit
970bef295d
3 changed files with 35 additions and 2 deletions
|
@ -252,7 +252,11 @@ class Generator:
|
|||
msg.set_boundary(boundary)
|
||||
# If there's a preamble, write it out, with a trailing CRLF
|
||||
if msg.preamble is not None:
|
||||
self.write(msg.preamble + self._NL)
|
||||
if self._mangle_from_:
|
||||
preamble = fcre.sub('>From ', msg.preamble)
|
||||
else:
|
||||
preamble = msg.preamble
|
||||
self.write(preamble + self._NL)
|
||||
# dash-boundary transport-padding CRLF
|
||||
self.write('--' + boundary + self._NL)
|
||||
# body-part
|
||||
|
@ -270,7 +274,11 @@ class Generator:
|
|||
self.write(self._NL + '--' + boundary + '--')
|
||||
if msg.epilogue is not None:
|
||||
self.write(self._NL)
|
||||
self.write(msg.epilogue)
|
||||
if self._mangle_from_:
|
||||
epilogue = fcre.sub('>From ', msg.epilogue)
|
||||
else:
|
||||
epilogue = msg.epilogue
|
||||
self.write(epilogue)
|
||||
|
||||
def _handle_multipart_signed(self, msg):
|
||||
# The contents of signed parts has to stay unmodified in order to keep
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue