Set the content length automatically before calling wrap_file

This commit is contained in:
Armin Ronacher 2013-05-30 14:24:29 +01:00
parent ffd9296507
commit 47572c5b40
2 changed files with 2 additions and 0 deletions

View file

@ -516,6 +516,7 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
if file is None:
file = open(filename, 'rb')
mtime = os.path.getmtime(filename)
headers['Content-Length'] = os.path.getsize(filename)
data = wrap_file(request.environ, file)
rv = current_app.response_class(data, mimetype=mimetype, headers=headers,