From 386724a98b1cb346493b5decd9dd944b423b60ba Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Wed, 2 May 2018 15:49:01 +0100 Subject: [PATCH 1/3] Update flask from 0.12.2 to 1.0.2 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8d05695de..e2a62c42c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ ago==0.0.92 -Flask==0.12.2 +Flask==1.0.2 Flask-WTF==0.14.2 Flask-Login==0.4.1 From 869e5cd76610f3e6a877f6fc3fa6a3c25cedc47a Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 30 May 2018 13:50:29 +0100 Subject: [PATCH 2/3] Added a 400 error handler --- app/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/__init__.py b/app/__init__.py index 376c976c5..c88c808dd 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -529,6 +529,10 @@ def register_errorhandlers(application): # noqa (C901 too complex) error_code = 500 return _error_response(error_code) + @application.errorhandler(400) + def handle_400(error): + return _error_response(400) + @application.errorhandler(410) def handle_gone(error): return _error_response(410) From 886ed01638b4dcc3440f82987bfcbfe7dbe1610b Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 30 May 2018 14:54:25 +0100 Subject: [PATCH 3/3] Flask has change how it handles werkzeug.routing.RequestRedirect, we need to add an errorhandler so that the request does the right thing. Refer to: https://github.com/pallets/flask/issues/671#issuecomment-305394901 --- app/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/__init__.py b/app/__init__.py index c88c808dd..157bdd72a 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -36,6 +36,7 @@ from notifications_utils.formatters import formatted_list from notifications_utils.sanitise_text import SanitiseASCII from werkzeug.exceptions import abort from werkzeug.local import LocalProxy +from werkzeug.routing import RequestRedirect from app import proxy_fix from app.config import configs @@ -580,6 +581,10 @@ def register_errorhandlers(application): # noqa (C901 too complex) ), 400) return useful_headers_after_request(resp) + @application.errorhandler(RequestRedirect) + def handle_301(error): + return error + @application.errorhandler(500) @application.errorhandler(Exception) def handle_bad_request(error):