web: Fix a crash related to byte paths on Python 3

This commit is contained in:
Adrian Sampson 2016-08-12 19:59:07 +00:00
parent 644cb86b24
commit 0833c82075

View file

@ -203,8 +203,11 @@ def all_items():
@app.route('/item/<int:item_id>/file')
def item_file(item_id):
item = g.lib.get_item(item_id)
response = flask.send_file(item.path, as_attachment=True,
attachment_filename=os.path.basename(item.path))
response = flask.send_file(
util.py3_path(item.path),
as_attachment=True,
attachment_filename=os.path.basename(item.path),
)
response.headers['Content-Length'] = os.path.getsize(item.path)
return response