mirror of
https://github.com/beetbox/beets.git
synced 2025-12-20 15:43:58 +01:00
Merge pull request #2593 from robot3498712/develop
fix /issues/2592: web: Use Unicode paths to send files on Windows und…
This commit is contained in:
commit
338d471dde
1 changed files with 4 additions and 2 deletions
|
|
@ -217,12 +217,14 @@ def all_items():
|
|||
@app.route('/item/<int:item_id>/file')
|
||||
def item_file(item_id):
|
||||
item = g.lib.get_item(item_id)
|
||||
item_path = util.syspath(item.path) if (os.name == 'nt') else (
|
||||
util.py3_path(item.path))
|
||||
response = flask.send_file(
|
||||
util.py3_path(item.path),
|
||||
item_path,
|
||||
as_attachment=True,
|
||||
attachment_filename=os.path.basename(util.py3_path(item.path)),
|
||||
)
|
||||
response.headers['Content-Length'] = os.path.getsize(item.path)
|
||||
response.headers['Content-Length'] = os.path.getsize(item_path)
|
||||
return response
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue