Skip to content

Commit 009c6a4

Browse files
committed
Slightly clearer layout for #2593, and comments
1 parent c840fea commit 009c6a4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

beetsplug/web/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,14 @@ def all_items():
217217
@app.route('/item/<int:item_id>/file')
218218
def item_file(item_id):
219219
item = g.lib.get_item(item_id)
220-
item_path = util.syspath(item.path) if (os.name == 'nt') else (
221-
util.py3_path(item.path))
220+
221+
# On Windows under Python 2, Flask wants a Unicode path. On Python 3, it
222+
# *always* wants a Unicode path.
223+
if os.name == 'nt':
224+
item_path = util.syspath(item.path)
225+
else:
226+
item_path = util.py3_path(item.path)
227+
222228
response = flask.send_file(
223229
item_path,
224230
as_attachment=True,

0 commit comments

Comments
 (0)