Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
6a31bc6d
Kaydet (Commit)
6a31bc6d
authored
Tem 23, 2012
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#15232: correctly mangle From lines in MIME preamble and epilogue
üst
e60e12b5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
2 deletions
+35
-2
generator.py
Lib/email/generator.py
+10
-2
test_email.py
Lib/email/test/test_email.py
+22
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/email/generator.py
Dosyayı görüntüle @
6a31bc6d
...
@@ -233,7 +233,11 @@ class Generator:
...
@@ -233,7 +233,11 @@ class Generator:
msg
.
set_boundary
(
boundary
)
msg
.
set_boundary
(
boundary
)
# If there's a preamble, write it out, with a trailing CRLF
# If there's a preamble, write it out, with a trailing CRLF
if
msg
.
preamble
is
not
None
:
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
# dash-boundary transport-padding CRLF
self
.
write
(
'--'
+
boundary
+
self
.
_NL
)
self
.
write
(
'--'
+
boundary
+
self
.
_NL
)
# body-part
# body-part
...
@@ -251,7 +255,11 @@ class Generator:
...
@@ -251,7 +255,11 @@ class Generator:
self
.
write
(
self
.
_NL
+
'--'
+
boundary
+
'--'
)
self
.
write
(
self
.
_NL
+
'--'
+
boundary
+
'--'
)
if
msg
.
epilogue
is
not
None
:
if
msg
.
epilogue
is
not
None
:
self
.
write
(
self
.
_NL
)
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
):
def
_handle_multipart_signed
(
self
,
msg
):
# The contents of signed parts has to stay unmodified in order to keep
# The contents of signed parts has to stay unmodified in order to keep
...
...
Lib/email/test/test_email.py
Dosyayı görüntüle @
6a31bc6d
...
@@ -1275,6 +1275,28 @@ From the desk of A.A.A.:
...
@@ -1275,6 +1275,28 @@ From the desk of A.A.A.:
Blah blah blah
Blah blah blah
"""
)
"""
)
def
test_mangle_from_in_preamble_and_epilog
(
self
):
s
=
StringIO
()
g
=
Generator
(
s
,
mangle_from_
=
True
)
msg
=
email
.
message_from_string
(
textwrap
.
dedent
(
"""
\
From: foo@bar.com
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary=XXX
From somewhere unknown
--XXX
Content-Type: text/plain
foo
--XXX--
From somewhere unknowable
"""
))
g
.
flatten
(
msg
)
self
.
assertEqual
(
len
([
1
for
x
in
s
.
getvalue
()
.
split
(
'
\n
'
)
if
x
.
startswith
(
'>From '
)]),
2
)
# Test the basic MIMEAudio class
# Test the basic MIMEAudio class
...
...
Misc/NEWS
Dosyayı görüntüle @
6a31bc6d
...
@@ -98,6 +98,9 @@ Core and Builtins
...
@@ -98,6 +98,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #15232: when mangle_from is True, email.Generator now correctly mangles
lines that start with 'From' that occur in a MIME preamble or epilogue.
- Issue #13922: argparse no longer incorrectly strips '--'s that appear
- Issue #13922: argparse no longer incorrectly strips '--'s that appear
after the first one.
after the first one.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment