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
e1292a25
Kaydet (Commit)
e1292a25
authored
Nis 08, 2011
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#11492: fix header truncation on folding when there are runs of split chars.
Not a complete fix for this issue.
üst
7da4db11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
header.py
Lib/email/header.py
+4
-3
test_email.py
Lib/email/test/test_email.py
+10
-0
No files found.
Lib/email/header.py
Dosyayı görüntüle @
e1292a25
...
...
@@ -464,12 +464,13 @@ class _ValueFormatter:
self
.
_current_line
.
reset
(
str
(
holding
))
return
elif
not
nextpart
:
# There must be some trailing split characters because we
# There must be some trailing or duplicated split characters
# because we
# found a split character but no next part. In this case we
# must treat the thing to fit as the part + splitpart because
# if splitpart is whitespace it's not allowed to be the only
# thing on the line, and if it's not whitespace we must split
# after the syntactic break.
In either case, we're done.
# after the syntactic break.
holding_prelen
=
len
(
holding
)
holding
.
push
(
part
+
splitpart
)
if
len
(
holding
)
+
len
(
self
.
_current_line
)
<=
self
.
_maxlen
:
...
...
@@ -484,7 +485,7 @@ class _ValueFormatter:
self
.
_lines
.
append
(
str
(
self
.
_current_line
))
holding
.
reset
(
save_part
)
self
.
_current_line
.
reset
(
str
(
holding
))
return
holding
.
reset
()
elif
not
part
:
# We're leading with a split character. See if the splitpart
# and nextpart fits on the current line.
...
...
Lib/email/test/test_email.py
Dosyayı görüntüle @
e1292a25
...
...
@@ -793,6 +793,16 @@ Subject: the first part of this is short,
;
this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself;"""
)
def
test_long_header_with_multiple_sequential_split_chars
(
self
):
# Issue 11492
eq
=
self
.
ndiffAssertEqual
h
=
Header
(
'This is a long line that has two whitespaces in a row. '
'This used to cause truncation of the header when folded'
)
eq
(
h
.
encode
(),
"""
\
This is a long line that has two whitespaces in a row. This used to cause
truncation of the header when folded"""
)
def
test_no_split_long_header
(
self
):
eq
=
self
.
ndiffAssertEqual
hstr
=
'References: '
+
'x'
*
80
...
...
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