mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 08:16:51 -04: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 notifications_utils.sanitise_text import SanitiseASCII
|
||||||
from werkzeug.exceptions import abort
|
from werkzeug.exceptions import abort
|
||||||
from werkzeug.local import LocalProxy
|
from werkzeug.local import LocalProxy
|
||||||
|
from werkzeug.routing import RequestRedirect
|
||||||
|
|
||||||
from app import proxy_fix
|
from app import proxy_fix
|
||||||
from app.config import configs
|
from app.config import configs
|
||||||
@@ -580,6 +581,10 @@ def register_errorhandlers(application): # noqa (C901 too complex)
|
|||||||
), 400)
|
), 400)
|
||||||
return useful_headers_after_request(resp)
|
return useful_headers_after_request(resp)
|
||||||
|
|
||||||
|
@application.errorhandler(RequestRedirect)
|
||||||
|
def handle_301(error):
|
||||||
|
return error
|
||||||
|
|
||||||
@application.errorhandler(500)
|
@application.errorhandler(500)
|
||||||
@application.errorhandler(Exception)
|
@application.errorhandler(Exception)
|
||||||
def handle_bad_request(error):
|
def handle_bad_request(error):
|
||||||
|
|||||||
Reference in New Issue
Block a user