Merge branch 'master' into euri10-master

This commit is contained in:
Adrian Sampson 2017-06-15 18:00:50 -04:00
commit 6f977877fe
3 changed files with 14 additions and 2 deletions

View file

@ -148,6 +148,8 @@ class MatchQuery(FieldQuery):
class NoneQuery(FieldQuery):
"""A query that checks whether a field is null."""
def __init__(self, field, fast=True):
super(NoneQuery, self).__init__(field, None, fast)

View file

@ -217,12 +217,20 @@ def all_items():
@app.route('/item/<int:item_id>/file')
def item_file(item_id):
item = g.lib.get_item(item_id)
# 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(
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

View file

@ -28,6 +28,8 @@ Fixes:
* :doc:`/plugins/lastgenre`: Fix a crash when using the `prefer_specific` and
`canonical` options together. Thanks to :user:`yacoob`. :bug:`2459`
:bug:`2583`
* :doc:`/plugins/web`: Fix a crash on Windows under Python 2 when serving
non-ASCII filenames. Thanks to :user:`robot3498712`. :bug:`2592` :bug:`2593`
1.4.4 (June 10, 2017)