forked from orbit-oss/flask
parent
f347d3c59e
commit
c52e1b7388
3 changed files with 30 additions and 2 deletions
8
CHANGES
8
CHANGES
|
|
@ -15,6 +15,14 @@ Major release, unreleased
|
|||
method returns compressed response by default, and pretty response in
|
||||
debug mode.
|
||||
|
||||
Version 0.12.3
|
||||
--------------
|
||||
|
||||
Bugfix release, unreleased
|
||||
|
||||
- Fix a ValueError caused by invalid Range requests in some cases
|
||||
|
||||
|
||||
Version 0.12.2
|
||||
--------------
|
||||
|
||||
|
|
|
|||
|
|
@ -591,7 +591,8 @@ def send_file(filename_or_fp, mimetype=None, as_attachment=False,
|
|||
rv = rv.make_conditional(request, accept_ranges=True,
|
||||
complete_length=fsize)
|
||||
except RequestedRangeNotSatisfiable:
|
||||
file.close()
|
||||
if file is not None:
|
||||
file.close()
|
||||
raise
|
||||
else:
|
||||
rv = rv.make_conditional(request)
|
||||
|
|
|
|||
|
|
@ -468,7 +468,7 @@ class TestSendfile(object):
|
|||
|
||||
@pytest.mark.skipif(
|
||||
not callable(getattr(Range, 'to_content_range_header', None)),
|
||||
reason="not implement within werkzeug"
|
||||
reason="not implemented within werkzeug"
|
||||
)
|
||||
def test_send_file_range_request(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -529,6 +529,25 @@ class TestSendfile(object):
|
|||
assert rv.status_code == 200
|
||||
rv.close()
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not callable(getattr(Range, 'to_content_range_header', None)),
|
||||
reason="not implemented within werkzeug"
|
||||
)
|
||||
def test_send_file_range_request_xsendfile_invalid(self):
|
||||
# https://github.com/pallets/flask/issues/2526
|
||||
app = flask.Flask(__name__)
|
||||
app.use_x_sendfile = True
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return flask.send_file('static/index.html', conditional=True)
|
||||
|
||||
c = app.test_client()
|
||||
|
||||
rv = c.get('/', headers={'Range': 'bytes=1000-'})
|
||||
assert rv.status_code == 416
|
||||
rv.close()
|
||||
|
||||
def test_attachment(self):
|
||||
app = flask.Flask(__name__)
|
||||
with app.test_request_context():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue