From e1097ff03785b6155cbf05b9fd6c186c9144b459 Mon Sep 17 00:00:00 2001 From: Jed Cunningham Date: Thu, 11 May 2023 17:21:51 -0600 Subject: [PATCH] Fix `url_for_asset` fallback and 404 on DAG Audit Log 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 57ea10b6529b9..79b244e3b61f4 100644 --- a/airflow/www/extensions/init_manifest_files.py +++ b/airflow/www/extensions/init_manifest_files.py @@ -46,7 +46,7 @@ def parse_manifest_json(): 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 1cd4e34328dd4..e897396f57298 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() }} - {% endblock %} {% block content %}