mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #20889 -- Prevented email.Header from inserting newlines
Passed large maxlinelen to email.Header to prevent newlines from being inserted into value returned by _convert_to_charset Thanks mjl at laubach.at for the report.
This commit is contained in:
parent
aeed2cf3b2
commit
6dca603abb
2 changed files with 9 additions and 1 deletions
|
@ -290,6 +290,13 @@ class HttpResponseTests(unittest.TestCase):
|
|||
self.assertRaises(UnicodeError, r.__setitem__, 'føø', 'bar')
|
||||
self.assertRaises(UnicodeError, r.__setitem__, 'føø'.encode('utf-8'), 'bar')
|
||||
|
||||
def test_long_line(self):
|
||||
# Bug #20889: long lines trigger newlines to be added to headers
|
||||
# (which is not allowed due to bug #10188)
|
||||
h = HttpResponse()
|
||||
f = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz a\xcc\x88'.encode('latin-1')
|
||||
f = f.decode('utf-8')
|
||||
h['Content-Disposition'] = u'attachment; filename="%s"' % f
|
||||
|
||||
def test_newlines_in_headers(self):
|
||||
# Bug #10188: Do not allow newlines in headers (CR or LF)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue