Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork16.7k
Closed
Labels
Description
fromflaskimportFlask,send_fileapp=Flask(__name__)app.use_x_sendfile=True@app.route('/')defindex():returnsend_file('/etc/passwd',mimetype='text/plain',conditional=True)
http get http://127.0.0.1:8009/ Range:bytes=10000- (the range needs to be invalid, so depending on the file sent the number needs to be higher) fails with this ValueError:
Traceback (most recent call last): File"/home/adrian/dev/indico/env/lib/python2.7/site-packages/flask/app.py", line1982, inwsgi_app response=self.full_dispatch_request() File"/home/adrian/dev/indico/env/lib/python2.7/site-packages/flask/app.py", line1614, infull_dispatch_request rv=self.handle_user_exception(e) File"/home/adrian/dev/indico/env/lib/python2.7/site-packages/flask/app.py", line1517, inhandle_user_exception reraise(exc_type, exc_value, tb) File"/home/adrian/dev/indico/env/lib/python2.7/site-packages/flask/app.py", line1612, infull_dispatch_request rv=self.dispatch_request() File"/home/adrian/dev/indico/env/lib/python2.7/site-packages/flask/app.py", line1598, indispatch_requestreturnself.view_functions[rule.endpoint](**req.view_args) File"/home/adrian/dev/indico/src/flasktest.py", line10, inindexreturn send_file('/etc/passwd',mimetype='text/plain',conditional=True) File"/home/adrian/dev/indico/env/lib/python2.7/site-packages/flask/helpers.py", line594, insend_filefile.close()AttributeError:'NoneType' object has no attribute 'close'
Probably just a missingif file is not None check.