Browse Source

Don't fail for unicode filenames with send_file(add_etags=True)

pull/237/head
Simon Sapin 14 years ago
parent
commit
8017febac4
  1. 5
      flask/helpers.py

5
flask/helpers.py

@ -379,7 +379,10 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
rv.set_etag('flask-%s-%s-%s' % (
os.path.getmtime(filename),
os.path.getsize(filename),
adler32(filename) & 0xffffffff
adler32(
filename.encode('utf8') if isinstance(filename, unicode)
else filename
) & 0xffffffff
))
if conditional:
rv = rv.make_conditional(request)

Loading…
Cancel
Save