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

jedcunningham pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 2b4ad8a18c Fix `url_for_asset` fallback and 404 on DAG Audit Log 
(#31233)
2b4ad8a18c is described below

commit 2b4ad8a18c7c3975a30afe86030b2db9f8daf6f6
Author: Jed Cunningham <[email protected]>
AuthorDate: Fri May 12 14:12:14 2023 -0500

    Fix `url_for_asset` fallback and 404 on DAG Audit Log (#31233)
    
    There was a 404 on the DAG Audit Log for bootstrap toggle css, which as
    far as I can tell, we aren't even trying to use. So we will no longer
    try and add it to the page.
    
    This highlighted the fact that if we don't have an asset in the
    manifest, `url_for_asset` would just leave off the filename completely.
    This resulted in the href being just `/static/`, with no filename as a
    breadcrumb in the eventual 404. Now we will just use the filename as-is
    so the 404 is more meaningful.
---
 airflow/www/extensions/init_manifest_files.py    | 2 +-
 airflow/www/templates/airflow/dag_audit_log.html | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/airflow/www/extensions/init_manifest_files.py 
b/airflow/www/extensions/init_manifest_files.py
index 57ea10b652..79b244e3b6 100644
--- a/airflow/www/extensions/init_manifest_files.py
+++ b/airflow/www/extensions/init_manifest_files.py
@@ -46,7 +46,7 @@ def configure_manifest_files(app):
     def get_asset_url(filename):
         if app.debug:
             parse_manifest_json()
-        return url_for("static", filename=manifest.get(filename, ""))
+        return url_for("static", filename=manifest.get(filename, filename))
 
     parse_manifest_json()
 
diff --git a/airflow/www/templates/airflow/dag_audit_log.html 
b/airflow/www/templates/airflow/dag_audit_log.html
index 1cd4e34328..e897396f57 100644
--- a/airflow/www/templates/airflow/dag_audit_log.html
+++ b/airflow/www/templates/airflow/dag_audit_log.html
@@ -49,7 +49,6 @@
 {% block head_css %}
 {{ super() }}
 <link href="{{ url_for_asset('dataTables.bootstrap.min.css') }}" 
rel="stylesheet" type="text/css" >
-<link href="{{ url_for_asset('bootstrap-toggle.min.css') }}" rel="stylesheet" 
type="text/css">
 {% endblock %}
 
 {% block content %}

Reply via email to