diff --git a/app/__init__.py b/app/__init__.py index 5b37c57bb..3f2d11606 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 @@ -532,6 +533,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) @@ -579,6 +584,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): diff --git a/requirements.txt b/requirements.txt index b34aa9329..904383aad 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