From 009c6a4f6d76496109ab9b9751ff22864cf612cd Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 15 Jun 2017 17:51:14 -0400 Subject: [PATCH] Slightly clearer layout for #2593, and comments --- beetsplug/web/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/beetsplug/web/__init__.py b/beetsplug/web/__init__.py index 00718dbfb..635c2f5a8 100644 --- a/beetsplug/web/__init__.py +++ b/beetsplug/web/__init__.py @@ -217,8 +217,14 @@ def all_items(): @app.route('/item//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)) + + # On Windows under Python 2, Flask wants a Unicode path. On Python 3, it + # *always* wants a Unicode path. + if os.name == 'nt': + item_path = util.syspath(item.path) + else: + item_path = util.py3_path(item.path) + response = flask.send_file( item_path, as_attachment=True,