From 886ed01638b4dcc3440f82987bfcbfe7dbe1610b Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 30 May 2018 14:54:25 +0100 Subject: [PATCH] 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):