add changelog for GH-2957

This commit is contained in:
David Lord 2019-01-07 06:56:20 -08:00
parent b570bf699c
commit 366f3f49af
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
3 changed files with 15 additions and 13 deletions

View file

@ -511,9 +511,10 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
compatibility with WSGI servers.
.. versionchanged:: 1.1
Filenames may be a `PathLike` object.
Filename may be a :class:`~os.PathLike` object.
.. versionadded:: 1.1
Partial content supports ``BytesIO``.
Partial content supports :class:`~io.BytesIO`.
:param filename_or_fp: the filename of the file to send.
This is relative to the :attr:`~Flask.root_path`
@ -606,6 +607,7 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
try:
fsize = file.getbuffer().nbytes
except AttributeError:
# Python 2 doesn't have getbuffer
fsize = len(file.getvalue())
headers['Content-Length'] = fsize
data = wrap_file(request.environ, file)