This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch v2-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit f0f67e8bc9dcb9444cfc5b88ee075191785469b7
Author: Jed Cunningham <[email protected]>
AuthorDate: Wed Nov 9 11:02:42 2022 -0800

    Replace FAB url filtering function with Airflows (#27576)
    
    Use our url filtering util function so there is consistency between
    FAB and Airflow routes.
    
    (cherry picked from commit b33d22c2243c552f4d1372bbe6b75e5fb097f567)
---
 airflow/www/extensions/init_appbuilder.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/airflow/www/extensions/init_appbuilder.py 
b/airflow/www/extensions/init_appbuilder.py
index 2a1ee904f8..fd66314550 100644
--- a/airflow/www/extensions/init_appbuilder.py
+++ b/airflow/www/extensions/init_appbuilder.py
@@ -215,6 +215,7 @@ class AirflowAppBuilder:
         else:
             self.post_init()
         self._init_extension(app)
+        self._swap_url_filter()
 
     def _init_extension(self, app):
         app.appbuilder = self
@@ -222,6 +223,17 @@ class AirflowAppBuilder:
             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

Reply via email to