mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
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
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user