Skip to content
Myr

Merge remote-tracking branch 'upstream/0.12-maintenance'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Adrian Moennich · committed by Adrian Moennich · parents 2ef2000, c52e1b7 · Browse files · 3 files+32 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+32 added−2 removed

  • tests:+22 added−1 removed
  • other:+10 added−1 removed

3 files+32 added−2 removed

modified:flask/helpers.py+2 added-1 removed
608 unmodified lines
609 try:610 rv = rv.make_conditional(request, accept_ranges=True,611 complete_length=fsize)612 except RequestedRangeNotSatisfiable:613 if file is not None:613 file.close()614 file.close()615 raise616 else:617 rv = rv.make_conditional(request)618 # make sure we don't send x-sendfile for servers that
402 unmodified lines
modified:tests/test_helpers.py+22 added-1 removed
504 unmodified lines
505 rv.close()506507 @pytest.mark.skipif(508 not callable(getattr(Range, 'to_content_range_header', None)),509 reason="not implement within werkzeug"509 reason="not implemented within werkzeug"510 )511 def test_send_file_range_request(self, app, client):512 @app.route('/')513 def index():
48 unmodified lines
562 datetime.datetime(1999, 1, 1))})563 assert rv.status_code == 200564 rv.close()565566 @pytest.mark.skipif(567 not callable(getattr(Range, 'to_content_range_header', None)),568 reason="not implemented within werkzeug"569 )570 def test_send_file_range_request_xsendfile_invalid(self, app, client):571 # https://github.com/pallets/flask/issues/2526572 app.use_x_sendfile = True573574 rv = client.get('/', headers={'Range': 'bytes=1000-'})575 assert rv.status_code == 416576 rv.close()577578 def test_attachment(self, app, req_ctx):579 app = flask.Flask(__name__)580 with app.test_request_context():581 with open(os.path.join(app.root_path, 'static/index.html')) as f:582 rv = flask.send_file(f, as_attachment=True,583 attachment_filename='index.html')584 value, options = \585 parse_options_header(rv.headers['Content-Disposition'])586 assert value == 'attachment'587 rv.close()588589 with open(os.path.join(app.root_path, 'static/index.html')) as f:590 rv = flask.send_file(f, as_attachment=True,591 attachment_filename='index.html')
318 unmodified lines
modified:CHANGES+8 added
146 unmodified lines
147.. _#2430: https://github.com/pallets/flask/pull/2430148.. _#2436: https://github.com/pallets/flask/pull/2436149.. _#2450: https://github.com/pallets/flask/pull/2450150151Version 0.12.3152--------------153154Bugfix release, unreleased155156- Fix a ValueError caused by invalid Range requests in some cases157158159Version 0.12.2160--------------161162Released on May 16 2017
616 unmodified lines