Skip to content

Commit 6f97787

Browse files
committed
Merge branch 'master' into euri10-master
2 parents ae3f9bf + 2144882 commit 6f97787

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

beets/dbcore/query.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ def value_match(cls, pattern, value):
148148

149149

150150
class NoneQuery(FieldQuery):
151+
"""A query that checks whether a field is null."""
152+
151153
def __init__(self, field, fast=True):
152154
super(NoneQuery, self).__init__(field, None, fast)
153155

beetsplug/web/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,20 @@ 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+
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+
220228
response = flask.send_file(
221-
util.py3_path(item.path),
229+
item_path,
222230
as_attachment=True,
223231
attachment_filename=os.path.basename(util.py3_path(item.path)),
224232
)
225-
response.headers['Content-Length'] = os.path.getsize(item.path)
233+
response.headers['Content-Length'] = os.path.getsize(item_path)
226234
return response
227235

228236

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Fixes:
2828
* :doc:`/plugins/lastgenre`: Fix a crash when using the `prefer_specific` and
2929
`canonical` options together. Thanks to :user:`yacoob`. :bug:`2459`
3030
:bug:`2583`
31+
* :doc:`/plugins/web`: Fix a crash on Windows under Python 2 when serving
32+
non-ASCII filenames. Thanks to :user:`robot3498712`. :bug:`2592` :bug:`2593`
3133

3234

3335
1.4.4 (June 10, 2017)

0 commit comments

Comments
 (0)