Skip to content

Commit

Permalink
Clean up syntax a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosagent committed Apr 1, 2016
1 parent b4dd92d commit 3353c14
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions flask/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,7 @@ def download_file(filename):
try:
if not os.path.isfile(filename):
raise NotFound()
except TypeError:
raise BadRequest()
except ValueError:
except (TypeError, ValueError):
raise BadRequest()
options.setdefault('conditional', True)
return send_file(filename, **options)
Expand Down
5 changes: 1 addition & 4 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,9 @@ def test_send_from_directory_bad_request(self):
app.root_path = os.path.join(os.path.dirname(__file__),
'test_apps', 'subdomaintestmodule')
with app.test_request_context():
try:
with pytest.raises(BadRequest):
rv = flask.send_from_directory('static', 'bad\x00')
rv.close()
assert False
except BadRequest:
pass

class TestLogging(object):

Expand Down

0 comments on commit 3353c14

Please sign in to comment.