forked from orbit-oss/flask
Make sure the attachment filename is text type.
If attachment filename is bytes type and contains non-ascii coded bytes, then the following ASCII encoding process will trigger UnicodeDecodeError exception. Fix issue #2933.
This commit is contained in:
parent
232e5c81bc
commit
40118e785f
3 changed files with 10 additions and 1 deletions
|
|
@ -644,6 +644,8 @@ class TestSendfile(object):
|
|||
(u'Ñandú/pingüino.txt', '"Nandu/pinguino.txt"',
|
||||
'%C3%91and%C3%BA%EF%BC%8Fping%C3%BCino.txt'),
|
||||
(u'Vögel.txt', 'Vogel.txt', 'V%C3%B6gel.txt'),
|
||||
# Native string not marked as Unicode on Python 2
|
||||
('tést.txt', 'test.txt', 't%C3%A9st.txt'),
|
||||
))
|
||||
def test_attachment_filename_encoding(self, filename, ascii, utf8):
|
||||
rv = flask.send_file('static/index.html', as_attachment=True, attachment_filename=filename)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue