aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-08-29 15:15:35 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-08-29 15:15:35 -0400
commit99d3146f122ee009691bb1727f8145b329199415 (patch)
treeae02d7b165132adfdc73992dd73423f3db5e62e0
parentef0528a9f2e1d55471b2109fcfffbc48b0e1ffd7 (diff)
downloadb4-99d3146f122ee009691bb1727f8145b329199415.tar.gz
Force CRLF lineseps only right before sending via smtp
We could be sending the patches via a web endpoint, for which we don't need to force CRLF line endings. Convert into CRLF only immediately before sending the message out via smtp. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 4296b10..8203a90 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -2911,8 +2911,6 @@ def send_mail(smtp: Union[smtplib.SMTP, smtplib.SMTP_SSL, None], msgs: Sequence[
maxheaderlen = 120
emldata = msg.as_string(maxheaderlen=maxheaderlen)
- # Force compliant eols
- emldata = re.sub(r'\r\n|\n|\r(?!\n)', '\r\n', emldata)
bdata = emldata.encode()
if patatt_sign:
import patatt
@@ -2969,6 +2967,8 @@ def send_mail(smtp: Union[smtplib.SMTP, smtplib.SMTP_SSL, None], msgs: Sequence[
if smtp:
sent = 0
for destaddrs, bdata in tosend:
+ # Force compliant eols
+ bdata = re.sub(rb'\r\n|\n|\r(?!\n)', b'\r\n', bdata)
smtp.sendmail(fromaddr, destaddrs, bdata)
sent += 1
return sent