Skip to content

Commit

Permalink
Replace FAB url filtering function with Airflows (#27576)
Browse files Browse the repository at this point in the history
Use our url filtering util function so there is consistency between
FAB and Airflow routes.
  • Loading branch information
jedcunningham committed Nov 9, 2022
1 parent 2ac45b0 commit b33d22c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions airflow/www/extensions/init_appbuilder.py
Expand Up @@ -215,13 +215,25 @@ def init_app(self, app, session):
else:
self.post_init()
self._init_extension(app)
self._swap_url_filter()

def _init_extension(self, app):
app.appbuilder = self
if not hasattr(app, "extensions"):
app.extensions = {}
app.extensions["appbuilder"] = self

def _swap_url_filter(self):
"""
Use our url filtering util function so there is consistency between
FAB and Airflow routes
"""
from flask_appbuilder.security import views as fab_sec_views

from airflow.www.views import get_safe_url

fab_sec_views.get_safe_redirect = get_safe_url

def post_init(self):
for baseview in self.baseviews:
# instantiate the views and add session
Expand Down

0 comments on commit b33d22c

Please sign in to comment.